Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #3995

Re: Ideas of a new version of PostScript

Path csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups comp.lang.postscript
Subject Re: Ideas of a new version of PostScript
Date Thu, 21 Mar 2024 07:31:57 -0000 (UTC)
Organization A noiseless patient Spider
Lines 33
Message-ID <utgnpd$22no8$5@dont-email.me> (permalink)
References <1705687027.bystand@zzo38computer.org>
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Thu, 21 Mar 2024 07:31:57 -0000 (UTC)
Injection-Info dont-email.me; posting-host="badb6633f042ee08dd03f65d8f49603e"; logging-data="2187016"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gV02CbhqCFadWRbELy/zU"
User-Agent Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock sha1:v+0VzwENspyW7d9Qj5OECz4P3hw=
Xref csiph.com comp.lang.postscript:3995

Show key headers only | View raw


To give an example of something that can ease the pains of stack-oriented 
programming, let me propose something I’ve been calling “</” and “/>”, or 
“stackbegin” and “stackend”, to support the use of multiple nested operand 
stacks.

Stackbegin pops a single integer off the stack:

    n </

It then pops the next n operands off the stack, and transfers them as the 
initial contents of a new operand stack. This becomes the current operand 
stack, and the previous operand stack is no longer accessible.

Stackend reverses the process:

    n />

It pops n off the stack, and asserts that there are exactly n operands 
remaining on the stack; these get transferred to the previous operand 
stack, which becomes the current operand stack while this one (now empty) 
is discarded.

This allows you to constrain sections of code to operating on a more 
restricted set of operands, without accidentally interfering with other 
operands that might be underneath, or leaving junk behind.

I also propose that “;” be an operator that asserts that the (current) 
operand stack is empty. E.g.

    8 8 mul = ;

pops two operands, multiplies them, prints the answer, and then verifies 
that the stack is now empty.

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Ideas of a new version of PostScript (called "Computer PostScript") news@zzo38computer.org.invalid - 2024-03-06 20:59 -0800
  Re: Ideas of a new version of PostScript (called "Computer PostScript") Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-07 05:29 +0000
    Re: Ideas of a new version of PostScript (called "Computer PostScript") news@zzo38computer.org.invalid - 2024-03-07 15:05 -0800
      Re: Ideas of a new version of PostScript (called "Computer PostScript") Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-07 23:38 +0000
        Re: Ideas of a new version of PostScript (called "Computer PostScript") news@zzo38computer.org.invalid - 2024-03-08 12:00 -0800
          Re: Ideas of a new version of PostScript (called "Computer PostScript") Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-08 20:53 +0000
    Re: Ideas of a new version of PostScript (called "Computer PostScript") David Newall <ghostscript@davidnewall.com> - 2024-03-26 16:20 +1100
      Re: Ideas of a new version of PostScript (called "Computer PostScript") news@zzo38computer.org.invalid - 2024-03-25 23:10 -0700
      Re: Ideas of a new version of PostScript (called "Computer PostScript") Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-26 06:20 +0000
        Re: Ideas of a new version of PostScript (called "Computer PostScript") rlhamil@smart.net (Richard L. Hamilton) - 2024-05-25 16:07 +0000
          Re: Ideas of a new version of PostScript (called "Computer PostScript") Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-05-25 22:31 +0000
  Re: Ideas of a new version of PostScript Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-21 07:31 +0000
  Re: Ideas of a new version of PostScript (called "Computer PostScript") Bozo User <anthk@disroot.org> - 2024-03-24 20:45 +0000
    Re: Ideas of a new version of PostScript (called "Computer PostScript") David Newall <ghostscript@davidnewall.com> - 2024-03-26 16:19 +1100

csiph-web