From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Rep Specing Variant Records
Date: Fri, 9 Oct 2009 21:49:38 -0500
Date: 2009-10-09T21:49:38-05:00 [thread overview]
Message-ID: <haosr5$a2r$1@munin.nbi.dk> (raw)
In-Reply-To: e70b8d9a-3868-4d09-b745-794674ea610a@m3g2000pri.googlegroups.com
I don't like responding to ancient messages, but...
"Adam Beneschan" <adam@irvine.com> wrote in message
news:e70b8d9a-3868-4d09-b745-794674ea610a@m3g2000pri.googlegroups.com...
...
>Finally, although it's theoretically possible to have tags in
>different places for two different (non-derived) tagged types, it
>makes implementing the language a lot more difficult. This is even
>more true now that interface types have been introduced in Ada 2005.
>(If you declare a root type Root_Type with a tag in a nonstandard
>place, and then later "type Child is new Root_Type and Interface_Type
>with...", then how is an operation on Interface_Type'Class going to
>know where to find the tag if you give it a Child?) So it is entirely
>reasonable for a compiler to insist on the tag being in a set place
>for every tagged type.
This is wildly incorrect and I want to set the record straight. We were very
concerned about this, since at least two existing Ada 95 compilers (IBM
Rational and Janus/Ada) supported non-standard tag locations, and we didn't
want to force those compilers to remove that capability (it seems likely
that they have customers depending on it). So there are rules specifically
added to eliminate the extra "difficulty implementing the language".
In particular, the case postulated above is allowed to be rejected by a
compiler, on the basis of 13.1(13.1/2):
"A type_declaration is illegal if it has one or more progenitors, and a
representation item applies to an ancestor, and this representation item
conflicts with the representation of some other ancestor. The cases that
cause conflicts are implementation defined." Note that in this case it is
the type declaration of Child that can be illegal, not the representation
clause on Root_Type. The AARM notes on 13.1(13.1/2) explain this further.
The result is that using non-default locations for tags is no more difficult
to implement in Ada 2005 as it is in Ada 95.
Randy.
prev parent reply other threads:[~2009-10-10 2:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 1:22 Rep Specing Variant Records R.B. Love
2009-09-16 8:19 ` Petter
2009-09-16 10:10 ` Martin
2009-09-16 15:03 ` Adam Beneschan
2009-09-17 2:39 ` Robert Love
2009-09-17 6:57 ` Niklas Holsti
2009-09-17 8:25 ` Martin
2009-09-18 2:28 ` Robert Love
2009-10-10 2:49 ` Randy Brukardt [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