Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object,comp.software-eng
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!newstand.syr.edu!news.maxwell.syr.edu!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!feed1.news.erols.com!howland.erols.net!spool.mu.edu!munnari.OZ.AU!news.mel.connect.com.au!news.syd.connect.com.au!syd.csa.com.au!news
From: donh@syd.csa.com.au (Don Harrison)
Subject: Re: OO, C++, and something much better!
X-Nntp-Posting-Host: dev50
Message-ID: <E3rDu6.7AJ@syd.csa.com.au>
Sender: news@syd.csa.com.au
Reply-To: donh@syd.csa.com.au
Organization: CSC Australia, Sydney
References: <c4iv57nc0b.fsf@hc17031.hcsd.ca>
Date: Thu, 9 Jan 1997 20:49:18 GMT
Lines: 34
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:239339 comp.lang.smalltalk:48818 comp.lang.eiffel:17226 comp.lang.ada:55801 comp.object:59583 comp.software-eng:52322

David Emery writes:

:>> 	- A completely consistent type structure, in which 
:>> 	  even basic types such as INTEGER are classes,
:>> 	  present in the general inheritance structure.
:>> 	  (In C++ or Java, for example, the basic types
:>> 	  are completely separate from the class and inheritance
:>> 	  structure.)
:>
:>OK, here you have me.  But, Eiffel hedges a bit here as well with its
:>"expanded types".
:
:I think that there is not a clear consensus on this as A Good Thing.
:From a practical perspective, there seems to be a significant price to
:pay for 'full generality' (e.g. integers are classes just like
:user-defined record types.)  Java, for instance, has primitive integer
:types, and my understanding that the reason for this is performance,
:pure and simple.  Making 'int' a class would result in unacceptable
:performance, both compile-time and runtime, for simple things like
:"a[i++] := b + c;" (for int a, b, c).

Eiffel expanded types (one of which is class INTEGER) are not accessed via
references so do not carry that overhead. Hence, they can be implemented as 
efficiently as Ada/C++ integers.

However, if you *do* need to define a more specific integer type, you can
inherit from the parent (reference) type, INTEGER_REF.


Don.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Don Harrison             donh@syd.csa.com.au


