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: fac41,953e1a6689d791f6 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,953e1a6689d791f6 X-Google-Attributes: gid103376,public X-Google-Thread: f79bb,953e1a6689d791f6 X-Google-Attributes: gidf79bb,public X-Google-Thread: fdb77,953e1a6689d791f6 X-Google-Attributes: gidfdb77,public X-Google-Thread: 1108a1,953e1a6689d791f6 X-Google-Attributes: gid1108a1,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Eiffel and Java Date: 1996/11/04 Message-ID: #1/1 X-Deja-AN: 194640039 references: <55562c$nkd@mulga.cs.mu.OZ.AU> <1996Oct31.162218.8386@schbbs.mot.com> organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.sather,comp.lang.java.advocacy,comp.object Date: 1996-11-04T00:00:00+00:00 List-Id: In article jsa@alexandria (Jon S Anthony) writes: > You mean something like, how does this work if you keep extending > the queues? That should be OK. If you mean something like, I > have a _different_ priority_queue thingy here (not derived from > queues) - will it just fit in and work? No, that will require > going back and futzing... This looks like a case where you want interface inheritance, so implement interface inheritance: generic type Stack_or_Queue is limited tagged private; type Element is tagged private; with function Pop(SQ: in Stack_or_Queue) return Element'Class is <>; with procedure Push(E: in Element; Onto: in out Stack_or_Queue) is <>; with function Is_Empty(SQ: in Stack_or_Queue) return Boolean is <>; -- etc. -- your procedure, function, or package goes here. For any Stack, Queue, Deque, etc., which matches the interface you can instantiate your generic. You can even figure out a meaningful definition of Is_Empty for a queue connected to a pipe if that is what you have. (For example, delay until the other end of the pipe is closed and return false, or until another element is put into the pipe and return true.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...