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.3 required=5.0 tests=BAYES_00,INVALID_MSGID,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,87a639f27a7cc47d,start X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Attribute definition clause for 'External_Tag Date: 1999/05/16 Message-ID: <8b1tUD#n#GA.208@newstoo.hiwaay.net>#1/1 X-Deja-AN: 478589979 Content-Transfer-Encoding: 7bit X-MSMail-Priority: Normal X-Priority: 3 Content-Type: text/plain; charset="Windows-1252" MIME-Version: 1.0 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Date: 1999-05-16T00:00:00+00:00 List-Id: Here's one for all the language lawyers out there... I wanted to relate the tags of a group of types all derived from a common abstract ancestor to the values an enumeration type whose values relate to the tagged types. To do this I used an attribute_definition_clause to specify the External_Tag attribute for each of the tagged types. My first approach was to use an clause of the form for Tagged_Type'External_Tag use Enum_Type'Image (Enum_Value); I was surprised that the compiler complained that the expression must be a static string. Why is such an expression not static? My next approach (the one I'm now using) was to replace the clause with one of the form for Tagged_Type'External_Tag use "ENUM_VALUE"; This is fine, as long as the string exactly matches the 'Image attribute, and I can simply relate Tags to enumeration values. E.g., I can say Enum_Var := Enum_Type'Value (Ada.Tags.External_Tag (Tagged_Type_Item'Tag)); However, I was even more surprised than I was about the staticness issue when I saw that the compiler did not complain if the same External_Tag attribute is defined for two different types of the same class -- i.e., descended from a common tagged ancestor. What say ye? 1. Should the 'Image attribute be allowed to define an external tag? 2. Should the compiler reject identical External_Tag attributes for types with a common ancestor? David C. Hoos, Sr.