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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: GNAT GPL 2013 bug? Date: Sat, 10 Aug 2013 08:51:34 +0200 Organization: cbb software GmbH Message-ID: References: <19fr4wmxmen$.gjbias2fj461$.dlg@40tude.net> <1pe6z4dg2xk9j$.1wdn31ijaldz3.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: akU61YSCmz18VAS8AmGZtg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:182932 Date: 2013-08-10T08:51:34+02:00 List-Id: On Fri, 09 Aug 2013 16:04:02 -0400, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> Why? null considered an object is not class-wide, so I see no difference to >> plain parameters. null.Foo would be illegal anyway and Foo (null) would be >> ambiguous (in presence of several overriding instances). > > type T is tagged ...; > type A is access T'Class; > procedure P (X: access T); > > X : A := null; > P(X); -- This is a dispatching call, so it needs to look at > -- X.all'Tag, which doesn't exist. Does is matter why Constraint_Error raised? I can "dispatch" on null anyway: type T is tagged null record; procedure P (X : T) is null; procedure R (X : access T'Class); procedure R (X : access T'Class) is begin X.P; end R; Putting null exclusion on primitive operations does not solve the problem (if there is any). It is too late. Dispatch happens before them. It seems that rather access T'CLass should be constrained to not null access T'Class. BTW, why Ada 2005 used incompatible null-exclusion instead of compatible null-permission, e.g. procedure P (X : null or access T); -- I accept null or something like that? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de