From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f607b0620470e366,start X-Google-Attributes: gid103376,public From: mfb@mbunix.mitre.org (Michael F Brenner) Subject: Re: Generic Stack: Version 2. Date: 1996/03/17 Message-ID: <4ih4g1$5g9@linus.mitre.org>#1/1 X-Deja-AN: 142977991 references: <4ieq3a$cnc@dmsoproto.ida.org> organization: Research Computer Facility, MITRE Corporation, Bedford, MA keywords: Generic Stack. newsgroups: comp.lang.ada Date: 1996-03-17T00:00:00+00:00 List-Id: 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.