comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: GNAT GPL 2013 bug?
Date: Fri, 9 Aug 2013 11:47:07 +0200
Date: 2013-08-09T11:47:07+02:00	[thread overview]
Message-ID: <19fr4wmxmen$.gjbias2fj461$.dlg@40tude.net> (raw)

ARM 3.9.2(10/2)

"... If the dispatching operation overrides an inherited subprogram, it
shall be subtype conformant with the inherited subprogram."

Does not-null constraint count? To me (I am not a language layer) it does.
But GNAT GPL 2013 (20130314) swallows this:

   type T is tagged null record;
   procedure P (X : access T) is null;

   type S is new T with null record;
   overriding procedure P (X : not null access S) is null;

Which is a bug to me.

P.S. Being subtype conformant to another type (T vs S) is a tricky part.
Presumably "the inherited subprogram" is

   procedure P (X : access T);

after T is replaced by S. Which gives

   procedure P (X : access S);

and this must be subtype conformant to

   overriding procedure P (X : not null access S);

which is not. Is it?

P.P.S. There is of course a deeper issue with any constraints put on or
lifted upon inheritance regarding LSP and substitutability. Because it
might be safe to weaken a constraint (precondition actually). E.g. turning
the example around:

   type T is tagged null record;
   procedure P (X : not null access T);

   type S is new T with null record;
   overriding procedure P (X : access S);

This might be safe as the clients are promised more.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

             reply	other threads:[~2013-08-09  9:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  9:47 Dmitry A. Kazakov [this message]
2013-08-09 10:38 ` GNAT GPL 2013 bug? 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
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