Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!mucs!chl From: chl@cs.man.ac.uk (Charles Lindsey) Newsgroups: comp.lang.eiffel Subject: Re: Eiffel cleanup #1: The creation mechanism Keywords: Separate operation on references from operations on objects Message-ID: <607@m1.cs.man.ac.uk> Date: 23 Jan 90 11:18:48 GMT References: <226@eiffel.UUCP> <7862@cognos.UUCP> <235@eiffel.UUCP> Organization: Dept. Of Comp Sci, Univ. of Manchester, UK. Lines: 38 bertrand@eiffel.UUCP (Bertrand Meyer) writes: >In keeping with my earlier note, Mr. Campbell would also accept one of >[3] > x := !! >[4] x := !!f (...) >if the base class of x's type has no creation procedure. >Forms [3] and [4], however, do not seem acceptable. The right-hand side >is not a true expression since its meaning depends >on the type of x, which does not even occur in that right-hand >side. As Hoare pointed out in his ``Hints on Programming Language >Design'' Stanford CS Report, 1973, reprinted in Ellis Horowitz's >``Programming Languages: A Grand Tour'', Computer Science Press, 1983), >one of the pleasant properties of expressions is that an >expression such as E + F can be understood solely in terms >of its parts. Here this is clearly violated. Although Tony Hoare's principle enunciated above seems a fundamental part of strong typing, there are precedents for breaking it in special very specific circumstances (where the meaning of the exception is "obviously" OK). Thus in PASCAL (also ALGOL 68) one may write somepointervariable := nil; even though the type of nil can only be determined from its context. Also, in ALGOL 68 one could write somevariable := SKIP; #SKIP returns an undefined value# and even somevariable := GOTO idontcare; #to break off the computation entirely# 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.