• Speeding up code - am I missing something?

    From rugxulo@gmail.com@21:1/5 to Robert Prins on Fri Aug 31 09:47:17 2018
    Hi,

    On Thursday, August 23, 2018 at 9:56:01 AM UTC-5, Robert Prins wrote:

    One feature sadly missing from Pascal is the fact that PL/I allows you to use '*' as array extents in a called proc, and the (hidden) descriptors that are also passed to it allow you to call the same proc with
    ...

    I don't quite understand what you mean here.

    and a set of builtin functions (lbound and hbound) can be used to retrieve the low and high bounds of the arrays. ;) It's a bit more convoluted to do this with Pascal...

    Are you talking about conformant arrays? Schemata? Open arrays?
    Even Turbo Pascal (only later versions?) had LOW() and HIGH() built-ins.
    Is that what you meant?

    * https://www.freepascal.org/docs-html/ref/refsu14.html

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Prins@21:1/5 to rugxulo@gmail.com on Sat Sep 1 10:08:35 2018
    On 2018-08-31 16:47, rugxulo@gmail.com wrote:
    Hi,

    On Thursday, August 23, 2018 at 9:56:01 AM UTC-5, Robert Prins wrote:

    One feature sadly missing from Pascal is the fact that PL/I allows you to use
    '*' as array extents in a called proc, and the (hidden) descriptors that are
    also passed to it allow you to call the same proc with
    ...

    I don't quite understand what you mean here.

    and a set of builtin functions (lbound and hbound) can be used to retrieve
    the low and high bounds of the arrays. ;) It's a bit more convoluted to do
    this with Pascal...

    Are you talking about conformant arrays? Schemata? Open arrays?
    Even Turbo Pascal (only later versions?) had LOW() and HIGH() built-ins.
    Is that what you meant?
    Not really. or maybe.

    Can Pascal (choose your flavour) handle passing these two different arrays of structures to a single procedure:

    dcl 1 s1,
    2 s2(2,3),
    3 v1 char (12),
    3 v2 char (15),
    2 s3(4,5),
    3 v3 char (19),
    3 v4 char (1);

    dcl 1 t1,
    2 t2(7,8),
    3 w1 char (14),
    3 w2 char (77),
    2 t3(3,3),
    3 w3 char (12),
    3 w4 char (1);

    Well, PL/I can:

    myproc: procedure(parm);
    dcl 1 parm,
    2 p2(*,*),
    3 w1 char (*),
    3 w2 char (*),
    2 s3(*,*),
    3 w3 char (*),
    3 w4 char (*);

    and trying to assign a char(14) to w(1,1) will happily cut off the last two characters when the procedure is passed s1. And when the SUBSCRIPTRANGE is enabled, you'll get an error when trying to access w3(4,5) when t1 is passed to the procedure.

    I don't think there's an easy way to do the same with Pascal, but I'm ready to be corrected.

    Robert
    --
    Robert AH Prins
    robert(a)prino(d)org

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marco van de Voort@21:1/5 to Robert Prins on Sat Sep 1 11:20:48 2018
    On 2018-09-01, Robert Prins <robert@prino.org> wrote:
    I don't think there's an easy way to do the same with Pascal, but I'm
    ready to be corrected.

    Not if you force static allocation. Since Delphi2 (1?) strings are mostly dynamically allocated, and the static allocation stuff didn't develop
    further.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rugxulo@gmail.com@21:1/5 to Robert Prins on Mon Sep 3 17:32:33 2018
    Hi,

    On Saturday, September 1, 2018 at 3:06:45 AM UTC-5, Robert Prins wrote:
    On 2018-08-31 16:47, rugxulo@gmail.hates.spam wrote:

    Are you talking about conformant arrays? Schemata? Open arrays?
    Even Turbo Pascal (only later versions?) had LOW() and HIGH() built-ins. Is that what you meant?
    Not really. or maybe.

    Can Pascal (choose your flavour) handle passing these two different arrays of structures to a single procedure:

    Well, PL/I can:

    But I don't grok PL/I, so you'll have to show me in a more Pascal-friendly pseudo-code.

    I don't think there's an easy way to do the same with Pascal, but I'm ready to
    be corrected.

    "Pascal" can mean any number of dialects and offshoots. Yes, there are
    several (potential) ways to solve the problem.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)