From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Rep Specing Variant Records Date: Fri, 9 Oct 2009 21:49:38 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <2009091520225816807-rblove@airmailnet> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1255143077 10331 69.95.181.76 (10 Oct 2009 02:51:17 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 10 Oct 2009 02:51:17 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Xref: g2news2.google.com comp.lang.ada:8643 Date: 2009-10-09T21:49:38-05:00 List-Id: I don't like responding to ancient messages, but... "Adam Beneschan" 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.