comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Type mess in Ada standard library
Date: 1999/07/23
Date: 1999-07-23T00:00:00+00:00	[thread overview]
Message-ID: <3798F02F.F56EA7C5@averstar.com> (raw)
In-Reply-To: 7n1uu4$so8$1@pegasus.csx.cam.ac.uk

Markus Kuhn wrote:
> 
> Why do the packages
> 
>   Ada.Streams.Stream_IO
> 
> and
> 
>   Ada.Text_IO.Text_Streams
> 
> both have to define their own identical but incompatible
> 
>   type Stream_Access is access all Streams.Root_Stream_Type'Class;
> 
> ???
> 
> This looks like a complete mess to me. If I use both packages (and
> it is certainly not unreasonable to do so!), I have two different types
> for exactly the same purpose. ...

Well, to answer this question narrowly:  These Stream_Access types
are *only* used as the result type of the "Stream" function, which
is designed for passing directly into another subprogram like
T'Input, T'Output, etc.  So at least in this particular case,
there is almost no need to define any variables of the type
Stream_Access (and in fact, it is probably unwise, since the
lifetime of the access values produced is tied to the lifetime
of the File type).

I appreciate your larger concern, but I think in this
case the use of a local Stream_Access type is appropriate.
Perhaps a "NOTE" to indicate the intended use of values of
Stream_Access type might have alleviated your concern.

> Markus
> 
> --
> Markus G. Kuhn, Computer Laboratory, University of Cambridge, UK
> Email: mkuhn at acm.org,  WWW: <http://www.cl.cam.ac.uk/~mgk25/>

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




      parent reply	other threads:[~1999-07-23  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-20  0:00 Type mess in Ada standard library Markus Kuhn
1999-07-20  0:00 ` Michael F. Yoder
1999-07-21  0:00 ` Robert Dewar
1999-07-21  0:00   ` Markus Kuhn
1999-07-21  0:00     ` Aidan Skinner
1999-07-21  0:00     ` Robert Dewar
1999-07-22  0:00       ` Bill Findlay
1999-07-23  0:00       ` Stanley R. Allen
1999-07-22  0:00     ` Bill Findlay
1999-07-23  0:00 ` Tucker Taft [this message]
replies disabled

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