comp.lang.ada
 help / color / mirror / Atom feed
From: "Ben Brosgol" <brosgol@world.std.com>
Subject: Re: what means the " ' " in use with a record type?
Date: Sun, 25 Aug 2002 15:42:17 GMT
Date: 2002-08-25T15:42:17+00:00	[thread overview]
Message-ID: <H1Ep8v.9v2@world.std.com> (raw)
In-Reply-To: rC_99.324$gK6.29595828@newssvr21.news.prodigy.com

Tom Moran wrote:
>   I suspect that qualified expressions are fairly rare in practice
> except for an allocation with an initial value.
>
> >    x := new (value => x, to => 1);
> >
> > then the allocator has no idea what you are talking about, since there
is
> > nothing to say that this is a node. The qualified expression fixes this
>   If x is an access to type node, why is the qualified expression needed,
> while it's not needed in:
>   type fruits is (apple, orange, banana);
>   type colors is (red, orange, yellow);
>   color : colors;
>   fruit : fruits;
> begin
>   color := orange;
>   fruit := orange;

As I recall, the original reason for the apostrophe is because, in the
absence of this feature, the general construct
  new T(expr)
could be ambiguous (or at least confusing to the human reader) in some
contexts -- i.e., is expr the value of a discriminant, or is it an
initialization for the allocated object?  The apostrophe clearly indicates
the intent, and can also serve the purpose of a type qualification as Robert
observed.

Ben Brosgol
Ada Core Technologies






  reply	other threads:[~2002-08-25 15:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c923f575.0208231040.301add2@posting.google.com>
2002-08-23 20:16 ` what means the " ' " in use with a record type? tmoran
2002-08-24 13:19   ` Robert Dewar
2002-08-25  6:15     ` tmoran
2002-08-25 15:42       ` Ben Brosgol [this message]
2002-08-25 23:29         ` Steven Deller
2002-08-26  1:20           ` tmoran
2002-08-26 20:43             ` Robert Dewar
2002-08-26 20:41       ` Robert Dewar
2002-08-26 21:37         ` tmoran
2002-08-25  5:00 ` R. Tim Coslet
replies disabled

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