Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!yale!cs.yale.edu!news From: news@cs.yale.edu (Usenet News) Newsgroups: comp.lang.eiffel Subject: Re: Questions on Eiffel inheritance and assertions Summary: ALSO info on Meyer's book Message-ID: <12654@cs.yale.edu> Date: 24 Jan 90 07:50:35 GMT References: <120002@gore.com> Reply-To: jellinghaus-robert@yale.UUCP Organization: Yale University Computer Science Dept, New Haven CT 06520-2158 Lines: 47 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_