comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GNAT GPL 2013 bug?
Date: Sat, 10 Aug 2013 08:51:34 +0200
Date: 2013-08-10T08:51:34+02:00	[thread overview]
Message-ID: <k71biho5pjg7.16zreugtnwyc6$.dlg@40tude.net> (raw)
In-Reply-To: wcczjsqk4wd.fsf@shell01.TheWorld.com

On Fri, 09 Aug 2013 16:04:02 -0400, Robert A Duff wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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


  reply	other threads:[~2013-08-10  6:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  9:47 GNAT GPL 2013 bug? Dmitry A. Kazakov
2013-08-09 10:38 ` sbelmont700
2013-08-09 11:01   ` Dmitry A. Kazakov
2013-08-09 11:06     ` sbelmont700
2013-08-09 11:36       ` Dmitry A. Kazakov
2013-08-09 15:48     ` Adam Beneschan
2013-08-09 16:11       ` Simon Wright
2013-08-09 16:52         ` Adam Beneschan
2013-08-09 18:25           ` Simon Wright
2013-08-09 18:39             ` Adam Beneschan
2013-08-09 19:28               ` Adam Beneschan
2013-08-09 20:05                 ` Robert A Duff
2013-08-09 20:30                   ` Adam Beneschan
2013-08-09 21:35                     ` Simon Wright
2013-08-10 15:10                     ` Shark8
2013-08-09 16:03     ` Simon Wright
2013-08-09 18:55     ` Randy Brukardt
2013-08-09 19:27       ` Dmitry A. Kazakov
2013-08-09 20:04         ` Robert A Duff
2013-08-10  6:51           ` Dmitry A. Kazakov [this message]
2013-08-12 16:52             ` Adam Beneschan
2013-08-12 17:03               ` Dmitry A. Kazakov
2013-08-12 17:20                 ` Adam Beneschan
2013-08-12 18:34                   ` Dmitry A. Kazakov
2013-08-12 20:12             ` Randy Brukardt
2013-08-13  6:43               ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox