Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!news.funet.fi!tukki.jyu.fi!sakkinen From: sakkinen@tukki.jyu.fi (Markku Sakkinen) Newsgroups: comp.lang.eiffel Subject: Re: Inheritance and Information Hiding Message-ID: <1991Feb1.141610.12951@tukki.jyu.fi> Date: 1 Feb 91 14:16:10 GMT References: <488@eiffel.UUCP> <1991Jan31.185534.24530@Think.COM> Reply-To: sakkinen@jytko.jyu.fi (Markku Sakkinen) Organization: University of Jyvaskyla, Finland Lines: 42 In article tynor@hydra.gatech.edu (Steve Tynor) writes: >>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). [...] > ... Indeed, not only "very difficult", but in many cases even theoretically impossible. >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). I sympathise, but even in languages that are essentially statically typed there are good reasons for some facilities that require run-time checks. The OOPSLA/ECOOP'90 proceedings contains at least two papers that tackle these issues: Lehrmann Madsen & Magnusson & Moller-Pedersen, Palsberg & Schwartzbach. Someone may note that I am here defending run-time checks, while in the immediately preceding posting I was rather on the side of static checking. To adapt a famous Einstein quote: Things should be checked at compile time as much as possible, but no more. Markku Sakkinen Department of Computer Science and Information Systems University of Jyvaskyla (a's with umlauts) PL 35 SF-40351 Jyvaskyla (umlauts again) Finland SAKKINEN@FINJYU.bitnet (alternative network address)