Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!zaphod.mps.ohio-state.edu!swrinde!ucsd!hub!eiffel!bertrand From: bertrand@eiffel.UUCP (Bertrand Meyer) Newsgroups: comp.lang.eiffel Subject: Re: Eiffel cleanup #1: The creation mechanism Summary: No exception need be made for null Keywords: Separate operation on references from operations on objects Message-ID: <243@eiffel.UUCP> Date: 16 Feb 90 20:00:07 GMT References: <226@eiffel.UUCP> <7862@cognos.UUCP> <235@eiffel.UUCP> <607@m1.cs.man.ac.uk> Organization: Interactive Software Engineering, Santa Barbara CA Lines: 31 From <607@m1.cs.man.ac.uk> by chl@cs.man.ac.uk (Charles Lindsey): > > Although Tony Hoare's principle [i.e., the meaning of an expression > should be fully deducible from the meanings of its constituents] > seems a fundamental part of strong typing, there are precedents for > breaking it. [..] Thus in PASCAL (also ALGOL 68) one may write > > somepointervariable := nil; > > even though the type of nil can only be determined from its context [...] > > In the case if Eiffel, I should have thought that the same exception could be > made for x := !!. It is not so different from x := null which apparently > Bertrand is prepared to condone. Actually it is different because in Pascal the type status of `nil' is murky: nil is a constant which must belong to every type, which is contradictory with the rest of the type system. No such problem arises in Eiffel thanks to the introduction of NONE: because NONE is a descendant of every class, we can define the type of `null' as being NONE, so that the assignment x := null is always typewise valid regardless of the type of x. -- -- Bertrand Meyer bertrand@eiffel.com