From: Bernd Holzmueller <holzmuel@informatik.uni-stuttgart.de>
Subject: Re: Choice of OO primitives in Ada95
Date: 1996/02/22
Date: 1996-02-22T00:00:00+00:00 [thread overview]
Message-ID: <312C236B.2344@informatik.uni-stuttgart.de> (raw)
In-Reply-To: 4gc2pu$6qj@ux1.lmu.edu
Ray Toal wrote:
>
> donh@syd.csa.com.au (Don Harrison) wrote:
>
> >1) Why should you have to specify that a type is 'tagged'? Can't the compiler work
> >that out for itself? eg. by seeing whether the type is extended elsewhere. The
> >developer is forced to worry about what should be an implementation issue.
>
> Requiring 'tagged' is a GOOD THING! Inheritance weakens encapsulation.
> The default case (no tagged) is that you design a type, and you
> provide all and only those operations that work on the type and you
> don't make any details available to anyone else - in short you
> fully control the type. Now if your intent is to ALLOW derivation
> then you must mark it tagged. This alerts the reader that this
> type may be derived from. Imagine a language in which you could
> inherit from any type you wanted to! :-) Whether or not a type
> should be tagged is a DESIGN decision; I totally disagree that it
> should be an implementation decision. By the way a compiler can not
> in general determine if the "type is extended elsewhere" since in
> Ada extensions can appear in other compilation units.
Actually, the compiler _can_ work out if a tag is necessary. This is the case only if
a type is used polymorphically, i.e., class-wide in Ada 95 terminology (and has
_nothing_ to do with type-extension). A different implementation model than is given
in the LRM would create a tag only in these cases, which would allow 'normal'
(monomorphic) uses of a tagged type be as efficient as the use of an untagged type.
The consequence is that a special kind of "tagged types" is not necessary if
efficiency is of concern. This is discussed in more detail in a paper at Ada-Europe 96.
Regarding the requirement to mark a type tagged to control type extension: I cannot
see any advantage in restricting the flexibility (in the sense of potential reuse)
of the language without gaining anything. Whether or not a programmer is going to
use a type for type extension is not relevant for the author of the original type
and should therefore not explicitly prohibitable by him. It could be of interest
for a _user_ of the original type because dispatching can be a concern, but not
necessarily because he may wish to use this type only monomorphically, and thus
no dispatching will ever occur.
Bernd
--
-----------------------------------------------------------------------------
Bernd Holzmueller,
Institute of Computer Science, University of Stuttgart
email : holzmuel@informatik.uni-stuttgart.de
http://www.informatik.uni-stuttgart.de/ifi/ps/bernd.html
-----------------------------------------------------------------------------
next prev parent reply other threads:[~1996-02-22 0:00 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <DMqHqF.9F1.0.-s@inmet.camb.inmet.com>
[not found] ` <DMu9yw.5ts@assip.csasyd.oz>
[not found] ` <4g2f8v$15lc@watnews1.watson.ibm.com>
1996-02-19 0:00 ` Choice of OO primitives in Ada95 Don Harrison
1996-02-19 0:00 ` Norman H. Cohen
1996-02-19 0:00 ` Robert A Duff
1996-02-20 0:00 ` Don Harrison
1996-02-20 0:00 ` Ray Toal
1996-02-21 0:00 ` Don Harrison
1996-02-23 0:00 ` Robert A Duff
1996-02-22 0:00 ` Bernd Holzmueller [this message]
1996-02-23 0:00 ` Robert A Duff
1996-02-20 0:00 ` Jon S Anthony
1996-02-22 0:00 ` Real OO (was Choice of OO primitives in Ada95) Don Harrison
1996-02-22 0:00 ` Robert Dewar
1996-02-23 0:00 ` Gene Ouye
1996-02-26 0:00 ` James O'Connor
1996-02-26 0:00 ` Gene Ouye
1996-02-22 0:00 ` Jon S Anthony
1996-02-24 0:00 ` Robert A Duff
1996-02-26 0:00 ` Don Harrison
1996-02-26 0:00 ` Matthew B. Kennel
1996-02-24 0:00 ` Valery Croizier
1996-02-26 0:00 ` So called Real OO (was blah blah blah...) Jon S Anthony
1996-02-23 0:00 ` Choice of OO primitives in Ada95 Robert A Duff
1996-02-21 0:00 ` Robert I. Eachus
1996-02-21 0:00 ` John DiCamillo
1996-02-22 0:00 ` Don Harrison
1996-02-24 0:00 ` Robert A Duff
[not found] <4fmrhk$7k3@erinews.ericsson.se>
1996-02-19 0:00 ` Richard A. O'Keefe
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox