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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: We should introduce aliased types Date: Fri, 1 Aug 2014 14:44:57 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1406922298 4675 69.95.181.76 (1 Aug 2014 19:44:58 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 1 Aug 2014 19:44:58 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:21381 Date: 2014-08-01T14:44:57-05:00 List-Id: "Victor Porton" wrote in message news:lrgnoc$di6$1@speranza.aioe.org... >I think we should introduce aliased types to allow self-referencing objects > and objects which we can access for object's internal purposes: > > type T is aliased > record > Ptr: access all T; > end; > > Every value of an aliased type should be aliased (whether we specify that > the particular value if aliased or don't specify). You do know that this is already true of almost all limited types (without any declaration)? I.e. type T; type Ptr_Holder (D : access T) is limited null record; type T is limited record Ptr : Ptr_Holder (T'Access); end record; is legal Ada. It's not allowed for non-limited types because assigning the object would break the self-referential link (it would point to the wrong object afterwards). And you can't directly declare a component as Ptr : access T := T'Access; because of accessibility; the problem isn't whether T is aliased or not. "access T" is a library-level type, while T'Access might refer to a local object, so the access type could outlive the object (in particular, this component could be copied into an object of another library-level type), and that's not allowed. Your idea would have to have the same restriction, so it wouldn't help any. Randy.