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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,34d47d048b177d0b X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: limited/non-limited in Ada95 Date: 1997/10/19 Message-ID: #1/1 X-Deja-AN: 282091406 References: <3442C2A3.3781@bix.com> <3449390f.142507@SantaClara01.news.InterNex.Net> <344a4329.812635@SantaClara01.news.InterNex.Net> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-10-19T00:00:00+00:00 List-Id: In article <344a4329.812635@SantaClara01.news.InterNex.Net>, tmoran@bix.com (Tom Moran) wrote: >>type DT is ...; >>type DT_Access is access all DT; > >>type T (D : DT_Access) is private; > >>You can then use Unchecked_Access: > >>declare >> D : aliased DT; >> O : T (D'Unchecked_Access); >>begin >Could you expand on that, I'm confused. I'd like > -- existing type T is limited, tagged > type Newer(X:in some_access_type) is new T with ... I thought the problem was that, because T was non-limited, you couldn't add an access discriminant. But you can add a discriminant of a named access type as a discriminant, even if the type is non-limited. (Note: "access discriminant" and "discriminant of a named access type" are two different things. The former is only allowed for types that are limited.) If T is limited, then it's probably simpler just to add an access discrimant to the derived type: type T is tagged limited private; type NT (D : access DT) is new T with private; Although it's perfectly legal to make the discriminant of NT have a named type: type NT (D : DT_Access) is new T with private; >Another problem is that once a tagged type is non-limited, no >extension can be, or have components that are,llimited. Yes, that's true. But you could always add a discriminant of a named access type to the derived type, to point to objects that are limited. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271