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

From Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups comp.lang.postscript
Subject Re: Ideas of a new version of PostScript
Date 2024-03-21 07:31 +0000
Organization A noiseless patient Spider
Message-ID <utgnpd$22no8$5@dont-email.me> (permalink)
References <1705687027.bystand@zzo38computer.org>

Show all headers | 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