comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Syntax for tagged record types
Date: 1997/05/27
Date: 1997-05-27T00:00:00+00:00	[thread overview]
Message-ID: <EAuH6F.1q8.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: dewar.864485829@merv


Robert Dewar (dewar@merv.cs.nyu.edu) wrote:

: Matthew says

: <<I think that using discriminants as "constructor arguments" is a real
: kludge, and obfuscates declarations.  Ada 95 doesn't have constructors, so
: let's not try to fight the language.>>

: Most people find the use of discriminants as "constructor arguments" a
: natural and powerful feature in Ada (though naturally they don't think
: in terms of this terminology).

One important thing to keep in mind.  Discriminants are only arguments
to the "default-initializing constructor" (the default expressions for
the components plus the optional procedure Initialize).  If you 
have more complicated kinds of "explicit" initialization in mind, then by 
all means write a (parameterized) function or procedure to do the work.

Also, if you look at how constructors are used in other OO languages, you
will often find their parameters are used to control things like size
or data structure variant.  In these cases, you have a practically direct
match to the use of discriminants, even in the Ada 83 world.

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




  parent reply	other threads:[~1997-05-27  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-24  0:00 Syntax for tagged record types Robert Dewar
1997-05-25  0:00 ` Matthew Heaney
1997-05-26  0:00   ` Robert A Duff
1997-05-27  0:00   ` Jon S Anthony
1997-05-27  0:00 ` Tucker Taft [this message]
1997-05-27  0:00 ` Dale Stanbrough
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox