comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Statically matching constraints
Date: Mon, 5 Feb 2007 19:13:16 -0600
Date: 2007-02-05T19:13:16-06:00	[thread overview]
Message-ID: <w5qdnebRGv9ASFrYnZ2dnUVZ_u6rnZ2d@megapath.net> (raw)
In-Reply-To: 1170462379.446684.247730@q2g2000cwa.googlegroups.com

"Adam Beneschan" <adam@irvine.com> wrote in message
news:1170462379.446684.247730@q2g2000cwa.googlegroups.com...
> I'm having a bit of trouble understanding the "both are nonstatic and
> result from..." clause of 4.9.1(1.3/2).  According to 7.3(13), if you
> have a discriminant on the ancestor subtype of a private extension,
> the full definition must impose a statically matching constraint,
> which takes you to 4.9.1.

This rule hasn't changed since Ada 95 (other than to make it into a list of
bullets in order to add a missing case for formal types).

...
> My reading is that Pak1 and Pak2 are illegal but Pak3 seems to be
> legal.  The constraints are all nonstatic (the fact that X is a
> constant in Pak2 isn't enough to make it static), but it seems to me
> that Pak3 is the only one where the constraint results from something
> mentioned in 4.9.1(1.3/2), since it seems to result from "the same
> evaluation of a range of a discrete_subtype_definition", while in Pak1
> and Pak2 the constraints result from evaluations of a variable or
> constant, respectively.  But it's a little confusing to me because I'm
> not clear on just what "result from" is supposed to mean, and the AARM
> is no help.
>
> Is my interpretation correct?

I don't think so. 7.3(13) is talking about the constraint of T in
T(Sub'Last). Since Sub is not static, Sub'Last isn't static either, so the
constraint of T(Sub'Last) isn't static. Thus the two copies of T(Sub'Last)
don't match.

The notes in AARM 7.3(13.e-g) give a clue to the answer to your question.
The AARM notes point out that you can't give a discriminant constraint in
the partial view if it is a discriminant. The same holds true for any
non-static value, because, by definition the two constraints are different
and non-static: thus they don't match.

(At least, that is how I interpret it.)

                            Randy.





  parent reply	other threads:[~2007-02-06  1:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-03  0:26 Statically matching constraints Adam Beneschan
2007-02-03 14:41 ` Ludovic Brenta
2007-02-06  1:13 ` Randy Brukardt [this message]
2007-02-06  2:27   ` Adam Beneschan
replies disabled

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