comp.lang.ada
 help / color / mirror / Atom feed
From: mfb@mbunix.mitre.org (Michael F Brenner)
Subject: Re: Generic Stack: Version 2.
Date: 1996/03/17
Date: 1996-03-17T00:00:00+00:00	[thread overview]
Message-ID: <4ih4g1$5g9@linus.mitre.org> (raw)
In-Reply-To: 4ieq3a$cnc@dmsoproto.ida.org

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.





           reply	other threads:[~1996-03-17  0:00 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <4ieq3a$cnc@dmsoproto.ida.org>]
replies disabled

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