[Push] On re-entrant PUSH programs and how prefix is postfix

Lee Spector lspector at hampshire.edu
Thu Feb 5 06:52:05 EST 2004


On Feb 5, 2004, at 5:03 AM, Maarten wrote:
> PPS. Another thought: why CODE.FROMBOOLEAN etc., and not simply add a 
> generic
> function TOCODE (or simply QUOTE??) ? Saves on the syntax, CODE.TOCODE 
> is a
> NOOP, and there is precedence for having TYPE.OP operate on a 
> different stack
> than TYPE (TYPE.= pushes on the boolean stack, CODE.NULL, CODE.ATOM,  
> does
> that too, not to speak of CODE.SIZE, CODE.POSITION, CODE.LENGTH that 
> operate
> on the integer stack.)

[Just have time for one quick reply now...]

The "FROM" instructions *are* generic in the sense that there's already 
INTEGER.FROMBOOLEAN, FLOAT.FROMBOOLEAN, etc. I don't think there's any 
advantage of the "TO" versions over the "FROM" versions, and while 
you're right that the naming conventions do allow for either one I 
think the "FROM" ones are a little more consistent... In Push1 there 
was a much more generic way of doing all of this, via CONVERT, which 
popped two items from the TYPE stack to know what goes where... but now 
the TYPE stack is gone so that's no longer an option. QUOTE doesn't 
work because  it can only get stuff from the executing code onto the 
code stack, not from other stacks... But I think the existence of QUOTE 
may be what made me leave these instructions out of the first Push2 
instruction set...

  -Lee

--
Lee Spector
Dean, Cognitive Science + Associate Professor, Computer Science
Cognitive Science, Hampshire College, Amherst, MA 01002
lspector at hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438





More information about the Push mailing list