comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Converting C++ class to Ada
Date: 1996/12/21
Date: 1996-12-21T00:00:00+00:00	[thread overview]
Message-ID: <JSA.96Dec20214303@alexandria> (raw)
In-Reply-To: JSA.96Dec11160847@alexandria


In article <32BAD007.648F@watson.ibm.com> "Norman H. Cohen" <ncohen@watson.ibm.com> writes:

> Jon S Anthony wrote:
>  
> > In article <mheaney-ya023280001812962110410001@news.ni.net> mheaney@ni.net (Matthew 
> > Heaney) writes:
> > 
> ...
> > > I thought that access discriminants (and parameters) without an explicit
> > > type raise Program_Error when you pass "null" as the value?
> > 
> > CE is raised if a null value is passed to an access _parameter_.  I
> > have never seen anything indicating that CE (or PE) is raised if a
> > null value is given for the value of an access _discriminant_.  A good
> > thing IMO on both counts.  See in particular 11.5(11)
> > 
> > Of course, given a recent little discussion on the GNAT chat list I
> > could simply have not found it yet... :-) But really, this point seems
> > pretty clear!

Criminey.  This one is yet another example of unnecessary RM opacity
after all... :-(


> A null access discriminant is a run-time error.
> 
> 11.5 is just a list of the language-defined checks, together with an
> informal description of when the checks occur.  The definitive rules
> about when a check is performed will be found in the "Dynamic Semantics"
> sections describing the execution, evaluation, or elaboration of the
> relevant constructs.

Yes, I actually looked around in the relevant places under this very
heading.


> Constraint_Error--see 4.6)...."   Hidden in 4.6(49) is the rule, "If the
> target type is an anonymous access type, a check is made that the value
> of the operand is not null...."  (4.6(57) states that the exception
> raised when this check fails is Constraint_Error.  The rule in RM
> 4.6(49) can be found using the index entry for "Access check".)

Even found this, but being listed under "Type Conversions" I
mistakenly did not think that it applied to the discriminant case
since that case was not also called out in 11.5(11) along with the
parameter case.

But actually, on a moments reflection this is the general rule and
must cover the parameter case as well (passing null like anything else
requires a conversion to the anonymous access type of the formal and
there you are).  This being the case it is highly unfortunate that the
discriminant case was not also called out in 11.5(11) or that the
parameter case was not _removed_ from 11.5(11).  As it sits the thing
is close to being inconsistent (at worst) or highly misleading (at
best).

Ugh!

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com





  parent reply	other threads:[~1996-12-21  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-10  0:00 Converting C++ class to Ada Ken Garlington
1996-12-11  0:00 ` Stephen Leake
1996-12-13  0:00   ` Stephen Leake
1996-12-11  0:00 ` Larry Kilgallen
1996-12-11  0:00 ` Norman H. Cohen
1996-12-12  0:00   ` Jon S Anthony
1996-12-11  0:00 ` Jon S Anthony
1996-12-12  0:00   ` Ken Garlington
1996-12-18  0:00   ` Jon S Anthony
1996-12-18  0:00     ` Matthew Heaney
1996-12-19  0:00     ` Robert A Duff
1996-12-20  0:00       ` Stephen Leake
1996-12-20  0:00         ` Robert A Duff
1996-12-20  0:00   ` Jon S Anthony
1996-12-20  0:00     ` Mitch Gart
1996-12-20  0:00   ` Norman H. Cohen
1996-12-21  0:00   ` Jon S Anthony [this message]
1996-12-12  0:00 ` Dale Stanbrough
1996-12-12  0:00   ` Constructors for Ada (was: Converting C++ class to Ada) Matthew Heaney
1996-12-13  0:00     ` Norman H. Cohen
1996-12-13  0:00       ` Matthew Heaney
1996-12-17  0:00   ` Robert I. Eachus
replies disabled

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