• Re: On Stack-Based Languages (was Re: on Perl)

    From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.programmer, comp.lang.misc on Thu Apr 18 07:55:42 2024
    From Newsgroup: comp.lang.misc

    On Wed, 17 Apr 2024 08:05:23 -0700, John Ames wrote:

    *Syntactically* it's very simple, but explicit stack-orientation with reverse-Polish notation is a *very* different programming paradigm than practically everything else out there ...

    The only really tricky part of stack-based programming is keeping track of what’s on the stack.

    I did some messing about with a reboot of PostScript which tried to add
    some niceties, like stack guards and lexical binding. Here’s an example of the sort of thing I was able to get working (“ddef” and “dstore” define
    and assign to dynamically-bound variables, while “ldef” and “lstore” correspondingly work on lexically-bound ones):

    /Count 99 ddef

    /metatry
    { % provides context for nonlocals
    dup
    /Name exch ldef
    /Count 0 ldef
    { % actual proc
    /Count dup lload 1 add lstore
    /Count dup dload 1 add dstore
    Name =
    (local Count = ) print /Count lload =
    (global Count = ) print /Count dload =
    (whichever Count = ) print Count =
    }
    }
    ddef

    /try1 metatry ddef
    /try2 metatry ddef

    try1
    try2
    try1
    try2

    Output:

    try1
    local Count = 1
    global Count = 100
    whichever Count = 1
    try2
    local Count = 1
    global Count = 101
    whichever Count = 1
    try1
    local Count = 2
    global Count = 102
    whichever Count = 2
    try2
    local Count = 2
    global Count = 103
    whichever Count = 2
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.programmer,comp.lang.misc on Thu Apr 18 10:37:47 2024
    From Newsgroup: comp.lang.misc

    On 18/04/2024 09:55, Lawrence D'Oliveiro wrote:
    On Wed, 17 Apr 2024 08:05:23 -0700, John Ames wrote:

    *Syntactically* it's very simple, but explicit stack-orientation with
    reverse-Polish notation is a *very* different programming paradigm than
    practically everything else out there ...

    The only really tricky part of stack-based programming is keeping track of what’s on the stack.

    I did some messing about with a reboot of PostScript which tried to add
    some niceties, like stack guards and lexical binding. Here’s an example of the sort of thing I was able to get working (“ddef” and “dstore” define
    and assign to dynamically-bound variables, while “ldef” and “lstore” correspondingly work on lexically-bound ones):


    I think I have only ever heard of one person who actually uses
    PostScript for programming by hand, rather than as a print output
    format. That is Don Lancaster, an electronics engineer who is a big fan
    of "magic sines" (binary strings with low harmonics) and does all his
    coding in PostScript. Anyone wanting to see a significant library of PostScript code might be interested.

    <https://www.tinaja.com/magsn01.shtml>


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.programmer,comp.lang.misc on Thu Apr 18 08:44:44 2024
    From Newsgroup: comp.lang.misc

    On Thu, 18 Apr 2024 10:37:47 +0200, David Brown wrote:

    I think I have only ever heard of one person who actually uses
    PostScript for programming by hand, rather than as a print output
    format. That is Don Lancaster ...

    I know, I have seen his site.

    The PostScript graphics model has long been superseded by worthy
    successors, like Cairo. I did my own Python binding for Cairo <https://gitlab.com/ldo/qahirah>, which adds things like vectors, matrices
    and colours as first-class objects--beyond what Cairo itself, as a C- language-based library, can do.

    What I am interested in here is the PostScript language itself, and how it
    can be modernized.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Anssi Saari@anssi.saari@usenet.mail.kapsi.fi to comp.unix.programmer,comp.lang.misc on Thu Apr 18 15:00:20 2024
    From Newsgroup: comp.lang.misc

    David Brown <david.brown@hesbynett.no> writes:

    I think I have only ever heard of one person who actually uses
    PostScript for programming by hand, rather than as a print output
    format.

    I think I got a postscript program from Usenet or somewhere to print CD
    covers once upon a time. Never used it though. I think the idea was to
    edit track and artist names directly into the code and send it to a
    printer.

    The author may have been Jamie Zawinski but I'm not sure.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From James K. Lowden@jklowden@speakeasy.net to comp.unix.programmer,comp.lang.misc on Fri Apr 19 14:16:28 2024
    From Newsgroup: comp.lang.misc

    On Thu, 18 Apr 2024 08:44:44 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

    The PostScript graphics model has long been superseded by worthy
    successors, like Cairo.

    Yes and no. I believe Keith Packard describes Cairo as PostScript
    without the syntax: it shares the same page-display model, but is
    presented as a set of C functions instead of a language.

    --jkl
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.programmer,comp.lang.misc on Fri Apr 19 21:57:53 2024
    From Newsgroup: comp.lang.misc

    On Fri, 19 Apr 2024 14:16:28 +0000, James K. Lowden wrote:

    I believe Keith Packard describes Cairo as PostScript
    without the syntax ...

    The PostScript graphics model (even Display PostScript) never progressed beyond the concept of putting marks on paper.

    While Cairo is clearly inspired by PostScript, it is also clearly an improvement on it, adding features specifically to support interactive graphics on a display screen, like operators and alpha channels. It also
    has better Unicode support.
    --- Synchronet 3.20a-Linux NewsLink 1.114