Xref: utzoo comp.lang.eiffel:1348 comp.object:2471 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool.mu.edu!sdd.hp.com!elroy.jpl.nasa.gov!ncar!gatech!prism!hydra.gatech.edu!tynor From: tynor@hydra.gatech.edu (Steve Tynor) Newsgroups: comp.lang.eiffel,comp.object Subject: Re: Inheritance and Information Hiding Message-ID: Date: 31 Jan 91 19:57:48 GMT References: <10612@pasteur.Berkeley.EDU> <485@eiffel.UUCP> <488@eiffel.UUCP> <1991Jan31.185534.24530@Think.COM> Sender: tynor@prism.gatech.EDU Followup-To: comp.lang.eiffel Organization: Georgia Tech Research Institute Lines: 28 In-reply-to: barmar@think.com's message of 31 Jan 91 18:55:34 GMT >From: barmar@think.com (Barry Margolin) ... >that RECTANGLE inherits from POLYGON. Override add_vertex in the RECTANGLE >class with a function that reports an error. Permit polymorphic >assignments of the form p=r, and accept the fact that it is possible for >p.add_vertex(...) to signal an error at runtime. This is not a realistic >solution in a language without a decent exception handling mechanism, but >that's an excuse for adding exception handling, not for crippling programs. The problem with this sort of solution is that it defers detection of the error until run-time. It is very difficult to statically examine your code to determine whether your program will fail (you have to do a dataflow analysis which is hard in general). I've run into more than a few latent bugs in large Flavors and C++ programs because of this sort of behavior. [ Before someone jumps on my case telling me about C++ pure virtuals, I know about them - in the case I'm describing, they were not used appropriately by the class designer ]. I'm a big believer in doing as much static code analysis as you (or better yet, the compiler) can - I realize that it is not always feasible (eg. in dynamic systems like CLOS and Flavors). =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "Language is a virus from outer space" - William S. Burroughs Steve Tynor Georgia Tech Research Institute Artificial Intelligence Branch tynor@prism.gatech.edu