comp.lang.ada
 help / color / mirror / Atom feed
* Re: Generic Stack: Version 2.
       [not found] <4ieq3a$cnc@dmsoproto.ida.org>
@ 1996-03-17  0:00 ` Michael F Brenner
  0 siblings, 0 replies; only message in thread
From: Michael F Brenner @ 1996-03-17  0:00 UTC (permalink / raw)


Thanks for the stack. Other considerations that might be included are:
(1) To compare stacks, you must add a generic parameter:
    function "=" (left, right: items) return boolean;
(2) It is gauche to raise constraint_error, but much better to 
    raise a meaningful error from your applications code.
(3) The application for these stacks must be for interrupt handlers,  
    rather than data structures for compilers and pattern recognizers,
    because the "extra" operators (beyond PUSH and POP) are equality
    testing and swap, rather than peeking, which would allow the user
    to cheat and look at elements beyone the top of the stack without
    popping them off. When PEEK_CHEAT is required by the stack's application,
    then the implementation should not be the way this example codes it,
    but rather it should be implemented on top of an ordinary heap. By
    "on top of" an ordinary heap, I mean that all heaps should have a PUSH
    and a POP so they can double as stacks, and the STACK package should
    just be a rename of the heap's PUSH and POP.





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-03-17  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4ieq3a$cnc@dmsoproto.ida.org>
1996-03-17  0:00 ` Generic Stack: Version 2 Michael F Brenner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox