Path: utzoo!attcan!uunet!jarthur!usc!ucsd!hub.ucsb.edu!eiffel!bertrand From: bertrand@eiffel.UUCP (Bertrand Meyer) Newsgroups: comp.object Subject: Re: inheritance and `type loss' Message-ID: <381@eiffel.UUCP> Date: 26 Jul 90 16:30:59 GMT References: <1990Jul26.120125.7955@tukki.jyu.fi> Distribution: comp Organization: Interactive Software Engineering, Santa Barbara CA Lines: 51 From <1990Jul26.120125.7955@tukki.jyu.fi> by sakkinen@tukki.jyu.fi (Markku Sakkinen): > Simula and many others (including C++ and Eiffel) don't even pretend > that 'integer' is a class. This is not quite correct with respect to Eiffel. INTEGER is an ``expanded type'' based on class INT, itself declared in the Kernel Library as class INT export infix "+", infix "-", ... prefix "+", prefix "-", infix "<", infix "<=", ... inherit COMPARABLE; FLOAT_CONV feature infix "+" (other: INT): INT is ... etc. end -- class INT Type INTEGER itself is an abbreviation for ``expanded INT'', meaning that instances of INTEGER do not need to be allocated dynamically, the way instances of a class type such as INT do. This was not described in the book ``Object-Oriented Software Construction'', which still treated integers and three other basic types in a special way, as implied by Mr. Sakkinen. However the full type system of Eiffel, with the above characteristics, is described in the current reference on the language, ``Eiffel: The Language'' (August 1989) and in an earlier document entitled ``Eiffel Types'' of which a quasi-final version was posted in comp.lang.eiffel on April 2, 1989 (message id <133@eiffel.UUCP>). The language definition treats class INT and its colleagues (CHAR, FLOAT, BOOL, DFLOAT) as normal classes, which may have descendants. In Interactive's current Eiffel implementation, there are still some limitations on writing classes that inherit from INT and the like; these are corrected, however, in the forthcoming release of our compiler. All this was done with the explicit aim of making the Eiffel type system completely consistent, and uniformly based on the notion of class. -- Bertrand Meyer bertrand@eiffel.com