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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.18.138 with SMTP id 10mr3365017ios.106.1519467534359; Sat, 24 Feb 2018 02:18:54 -0800 (PST) X-Received: by 10.157.14.214 with SMTP id 80mr184622otj.9.1519467534231; Sat, 24 Feb 2018 02:18:54 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer02.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!o66no1104530ita.0!news-out.google.com!10ni1395ite.0!nntp.google.com!w142no1107148ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 24 Feb 2018 02:18:53 -0800 (PST) In-Reply-To: <93229821-ae3d-4e47-91d9-a20ff3c1f1a7@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2003:c7:83cd:ca9f:392a:1f8a:c01f:ca4b; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 2003:c7:83cd:ca9f:392a:1f8a:c01f:ca4b References: <93229821-ae3d-4e47-91d9-a20ff3c1f1a7@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: two questions on allocators From: AdaMagica Injection-Date: Sat, 24 Feb 2018 10:18:54 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 4074629965 X-Received-Bytes: 2501 Xref: reader02.eternal-september.org comp.lang.ada:50620 Date: 2018-02-24T02:18:53-08:00 List-Id: Am Freitag, 23. Februar 2018 21:42:14 UTC+1 schrieb Mehdi Saada: > type A is access INTEGER; > type B is access not null A; > type C is access B; > Object_C : C := new B; > is allowed, but not > type A is access INTEGER; > type B is access A; > type C is access B; > Object_C : C := new not null B; ?? What's the difference ? As Shark8 has already said, new not null B is a syntax error. > If the designated type of the allocator is class-wide, the accessibility level of the type determined by the subtype_indication or qualified_expression shall not be statically deeper than that of the type of the allocator. > > -> what means the last "type of the allocator" ? Is it the same than "designed type of the allocator" ? > Does it refer to this situation ? -> > type T is access some_tagged_type'Class; > POINTER : T; > declare > type CHILD is new some_tagged_type with ... > begin > POINTER := new CHILD; --illegal > end; The access object is POINTER, its type is T, the designated (not designed) type is some_tagged_type'Class, the type determined by the subtype_indication is Child, as you have declared.