comp.lang.ada
 help / color / mirror / Atom feed
From: "Hibou57 (Yannick Duchêne)" <yannick_duchene@yahoo.fr>
Subject: Ada 95 and Class attribute for none-tagged incomplete type
Date: Sat, 1 Aug 2009 23:55:16 -0700 (PDT)
Date: 2009-08-01T23:55:16-07:00	[thread overview]
Message-ID: <8442c52d-805f-4ca8-95ab-b4c8e949d7cd@k6g2000yqn.googlegroups.com> (raw)

Hello,

I've learned something mostly surprising today : in Ada 95, this was
allowed to use the Class attribute with a prefix which was an
incomplete type.... even not tagged.

I've learned about it here :

http://www.adaic.org/standards/05rat/html/Rat-1-3-3.html
>> ------------------
The introduction of tagged incomplete types clarifies the ability to
write
type T_Ptr is access all T'Class;
This was allowed in Ada 95 even though we had not declared T as tagged
at this point. Of course it implied that T would be tagged. In Ada
2005 this is frowned upon since we should now declare that T is tagged
incomplete if we wish to declare a class wide access type. For
compatibility the old feature has been retained but banished to Annex
J for obsolescent features.
>> ------------------

The part of the mentionned annex J
>> ------------------
For the first subtype S of a type T declared by an
incomplete_type_declaration that is not tagged, the following
attribute is defined:
S'Class
Denotes the first subtype of the incomplete class-wide type rooted at
T. The completion of T shall declare a tagged type. Such an attribute
reference shall occur in the same library unit as the
incomplete_type_declaration.
>> ------------------

But why was it allowed ?
There was no way to declare an incomplete tagged ?
So why to allow reference to a Class attribute in such circumstances ?

This seems weird ... to allow to make reference to a class attribute
of a none-tagged type (even if the complete view is tagged)

Was this a design error or were there some reasons or is there
something I did not understand ?



             reply	other threads:[~2009-08-02  6:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-02  6:55 Hibou57 (Yannick Duchêne) [this message]
2009-08-03 15:26 ` Ada 95 and Class attribute for none-tagged incomplete type Adam Beneschan
2009-08-03 18:45   ` Dmitry A. Kazakov
2009-08-13  1:50   ` Randy Brukardt
2009-08-13  8:18     ` Niklas Holsti
2009-08-13 13:16       ` Robert A Duff
2009-08-14  4:21         ` Randy Brukardt
2009-08-14 19:01           ` Robert A Duff
2009-08-14 23:41             ` Randy Brukardt
2009-08-15 14:33               ` Robert A Duff
2009-08-14  4:17       ` Randy Brukardt
replies disabled

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