• PostScript Ideas Worth Resurrecting

    From Lawrence D'Oliveiro@21:1/5 to All on Sun Mar 3 05:42:49 2024
    PostScript, both as a language and as a graphics API, are just museum
    pieces now.

    Nevertheless, there were some interesting ideas in the language part, that
    are still worth looking at. For example, executable arrays are basically functions as first-class objects. This is key to implementing control constructs (both conditional and looping) as straight built-in functions,
    with no special syntax of their own.

    But these “function” objects do have some deficiencies: no (simple)
    support for reentrant local variables, and no lexical binding. Fix these
    up, and you have a much more useful language.

    I have been playing off and on with a toy implementation of a PostScript variant with these characteristics. While I was at it, I added some stack- safety features to try to make stack-based programming less confusing and error-prone.

    I also got as far as implementing Python-style generator functions. But I
    think I might replace that in favour of something more ambitious, namely Scheme-style continuations.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Newall@21:1/5 to Lawrence D'Oliveiro on Tue Mar 26 16:11:07 2024
    On 3/3/24 16:42, Lawrence D'Oliveiro wrote:
    But these “function” objects do have some deficiencies: no (simple) support for reentrant local variables, and no lexical binding. Fix these
    up, and you have a much more useful language.

    % p1 p2 p3 f - % demonstrate local variables and recursive parameters
    /f {
    6 dict begin
    /p3 exch def
    /p2 exch def
    /p1 exch def
    /l1 (value) def
    /l2 (value) def
    /l3 (value) def
    ...
    end
    } def

    No?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to David Newall on Tue Mar 26 06:19:49 2024
    On Tue, 26 Mar 2024 16:11:07 +1100, David Newall wrote:

    On 3/3/24 16:42, Lawrence D'Oliveiro wrote:

    But these “function” objects do have some deficiencies: no (simple)
    support for reentrant local variables, and no lexical binding. Fix
    these up, and you have a much more useful language.

    % p1 p2 p3 f - % demonstrate local variables and recursive parameters
    /f {
    6 dict begin
    /p3 exch def
    /p2 exch def
    /p1 exch def
    /l1 (value) def
    /l2 (value) def
    /l3 (value) def ...
    end
    } def

    No?

    Notice I said “reentrant”?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Tue Mar 26 20:15:33 2024
    On Tue, 26 Mar 2024 06:19:49 -0000 (UTC), I wrote:

    On Tue, 26 Mar 2024 16:11:07 +1100, David Newall wrote:

    On 3/3/24 16:42, Lawrence D'Oliveiro wrote:

    But these “function” objects do have some deficiencies: no (simple)
    support for reentrant local variables, and no lexical binding. Fix
    these up, and you have a much more useful language.

    % p1 p2 p3 f - % demonstrate local variables and recursive parameters
    /f {
    6 dict begin
    /p3 exch def
    /p2 exch def
    /p1 exch def
    /l1 (value) def
    /l2 (value) def
    /l3 (value) def ...
    end
    } def

    No?

    Notice I said “reentrant”?

    Sorry, that is of course reentrant. But it does dynamic binding, not
    lexical.

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