jacob@gore.com (Jacob Gore) (01/24/90)
Could someone clarify these details of Eiffel: 1. Are non-exported ("secret", right?) routines inheritable? 2. Is there a short way to include the precondition in the postcondition? For example, is there a shorthand for: require "a long list of assertions" do "routine body" ensure "same list of assertions as in the require clause" "some new assertions" end (I don't have an Eiffel compiler to try these; my computer is a NeXT.) Jacob -- Jacob Gore Jacob@Gore.Com boulder!gore!jacob
news@cs.yale.edu (Usenet News) (01/24/90)
The questions you posed are specifically answered in each of two different sources I have: Bertrand Meyer's book _Object-Oriented Software Construction_ (New York, Prentice-Hall, 1988), ISBN 0-13-629049-3 in hardback (which is the only available U.S. version), and the _Eiffel: The Language_ manual, TR-EI-17/RM from ISE. The first will be referred to as [Meyer] and the second as [Ref]. In article <120002@gore.com> jacob@gore.com (Jacob Gore) writes: >1. Are non-exported ("secret", right?) routines inheritable? Yes. All features defined in a class are inherited by any descendants of that class, subject to the normal redefinition and renaming rules. [Meyer, section 1.5.3] [Ref, section 7.6]. Export clauses have nothing to do with inheritance. >2. Is there a short way to include the precondition in the postcondition? >For example, is there a shorthand for: > > require > "a long list of assertions" > do > "routine body" > ensure > "same list of assertions as in the require clause" > "some new assertions" > end What you are looking for is some set of assertions that is true for the class whenever a routine is not being executed, right? "A long list of assertions" is true before every routine starts and after every routine ends? You want to use the "invariant" clause [Meyer, sections 7.4.1 and 7.4.2] [Ref, section 12.5]. >(I don't have an Eiffel compiler to try these; my computer is a NeXT.) Procure the Eiffel 2.2 reference manual described above, and you'll have enough information to _write_ an Eiffel compiler. Post to comp.lang.eiffel for an Eiffel grammar (posted recently by ISE). Many people will be grateful for a non-ISE Eiffel implementation. >Jacob Gore Jacob@Gore.Com boulder!gore!jacob Rob Jellinghaus | "Next time you see a lie being spread or a jellinghaus-robert@CS.Yale.EDU | bad decision being made out of sheer ignor- ROBERTJ@{yalecs,yalevm}.BITNET | ance, pause, and think of hypertext." {everyone}!decvax!yale!robertj | -- K. Eric Drexler, _Engines of Creation_