From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: Derivation + Access Discriminant = Headaches
Date: 1999/03/20
Date: 1999-03-20T00:00:00+00:00 [thread overview]
Message-ID: <7cv0nu$dvk$4@plug.news.pipex.net> (raw)
In-Reply-To: m3r9qlvpuv.fsf@mheaney.ni.net
RM95 3.7(15):
15 If a discriminant is used in the constraint defining the parent
subtype, the subtype of the discriminant shall be statically
compatible (see 4.9.1) with the subtype of the corresponding
parent discriminant.
AARM comments:
15.a Reason: This ensures that on conversion (or extension via an
extension aggregate) to a distantly related type, if the
discriminants satisfy the target type's requirements they
satisfy all the intermediate types' requirements as well.
15.b Ramification: There is no requirement that the new discriminant
have the same (or any) default_expression as the parent's
discriminant.
Thus it's no bug.
However, I don't see why redefined access discriminants shouldn't be allowed
to designate a type derived from (or within the class of) the type
designated by the corresponding parental discriminant. An extra compiler
check would be required: if an object of type T were to be converted to type
NT (by an extension aggregate), its discriminant, O, would have to be
checked for being in NT'Class (and Constraint_Error, presumably, raised if
not). Conversions to 'distantly related types' would still only require one
check, however, so the problem mentioned in AARM (15.a) is solved.
Possibly this is something that could be changed at the next revision, if
it's not considered an unnecessary complication (or there's some other
reason why not that I'm missing).
I guess Tuck or Bob will correct me if I'm on the wrong track here (again
;-).
-------------------------------------
Nick Roberts
-------------------------------------
prev parent reply other threads:[~1999-03-20 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-19 0:00 Derivation + Access Discriminant = Headaches Matthew Heaney
1999-03-19 0:00 ` Richard D Riehle
1999-03-19 0:00 ` Matthew Heaney
1999-03-19 0:00 ` Stephen Leake
1999-03-20 0:00 ` Richard D Riehle
1999-03-20 0:00 ` Nick Roberts [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