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.224.173.4 with SMTP id n4mr9947570qaz.3.1376063332792; Fri, 09 Aug 2013 08:48:52 -0700 (PDT) X-Received: by 10.50.87.40 with SMTP id u8mr231025igz.4.1376063332741; Fri, 09 Aug 2013 08:48:52 -0700 (PDT) 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!usenet.blueworldhosting.com!feeder02.blueworldhosting.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!fx3no1801917qab.0!news-out.google.com!he10ni1155qab.0!nntp.google.com!fx3no1801911qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 9 Aug 2013 08:48:52 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=RxNzCgoAAACA5KmgtFQuaU-WaH7rjnAO NNTP-Posting-Host: 66.126.103.122 References: <19fr4wmxmen$.gjbias2fj461$.dlg@40tude.net> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <72539e4c-dddd-40e4-82e8-14c4f2016ccc@googlegroups.com> Subject: Re: GNAT GPL 2013 bug? From: Adam Beneschan Injection-Date: Fri, 09 Aug 2013 15:48:52 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3507 Xref: news.eternal-september.org comp.lang.ada:16717 Date: 2013-08-09T08:48:52-07:00 List-Id: On Friday, August 9, 2013 4:01:21 AM UTC-7, Dmitry A. Kazakov wrote: =20 > > Aren't dispatching access parameters inherently always 'not null' anywa= y, > > and the explicit qualifier just an optional readability thing? >=20 > No idea, but since Ada 2005 access T can be null. Is the behavior depends > on whether the parameter is dispatching? >=20 > So considering: >=20 > type Q is null record; > procedure P (X : access Q) is null; >=20 > Y : access Q :=3D null; > begin > P (Y); -- This is OK (since Ada 2005) >=20 > Now add "tagged" to Q: >=20 > type Q is tagged null record; > procedure P (X : access Q) is null; >=20 > Y : access Q :=3D null; > begin > P (Y); -- This is not OK? >=20 > I didn't searched ARM for this, but if indeed so, this is a language bug = to > me. It was a deliberate design decision. The big difference in your second exa= mple isn't just that Q is now tagged; the big difference is that P has beco= me a dispatching procedure, and it dispatches on the argument X. Passing n= ull for X wouldn't make any sense--what would it dispatch to? =20 In this example: type Q is tagged null record; package Inner is procedure P (X : access Q) is null; end Inner; now X can be null, since P isn't dispatching. In some of the examples in y= our later post (like the one where Q is private and the full type is a tagg= ed record), there isn't a problem either, since the procedure isn't dispatc= hing. It has always been the case since Ada 95 that access parameters used for di= spatching may not be null. In Ada 95, actuals for other access parameters = weren't allowed to be null either. In Ada 2005, the language was changed t= o allow null for access parameters, *except* for those (controlling paramet= ers) which could be dispatched on. It was also changed to allow "not null"= . I believe there was a dilemma when it came to controlling parameters--th= ose still could not be null, but did they want to explicitly require "not n= ull" on them? The decision was to make those implicitly "not null", which = makes some language rules a bit inconsistent but preserved backward compati= bility. -- Adam =20