comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Why does `Unchecked_Deallocation` need the access type?
Date: Wed, 29 Jul 2015 08:28:54 +0200
Date: 2015-07-29T08:28:54+02:00	[thread overview]
Message-ID: <mu2l292s5nlq$.1ag4nqmfs3kyl$.dlg@40tude.net> (raw)
In-Reply-To: mp8s01$g5i$1@loke.gir.dk

On Tue, 28 Jul 2015 16:25:19 -0500, Randy Brukardt wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
> news:170ajsv4tazu3.mgrs0or8en9w$.dlg@40tude.net...
>> 3. Tagged hierarchies
>>
>> type S is new T with private;
>>
>> S'Parent (T'Class) = T (in a public context)
>>
>> The argument indicates the hierarchy where to search for the ancestor (due
>> to MI).
> 
> We tried such an attribute sometime during the Ada 2005 work and eventually 
> gave up. The problem being that the parent (in a language sense - it's the 
> subtype after "new") depends on the visibility on the type, and that is very 
> unconfortable (besides causing problems):
> 
>   package P is
>       type S is new T with private;
>       procedure Bar (Obj : in out S'Parent); -- S'Parent is T here.
>   private
>       type S in new U with private; -- U is descended from T, of course.
>   end P;
> 
>   package body P is
>       procedure Bar (Obj : in out S'Parent) is -- !! - S'Parent is U here.

I see. Perhaps:

   procedure Bar (Obj : in out S'Public_Parent) is
      -- S'Parent is U here
      -- S'Public_Parent is still T

------------------------
Of course nobody should ever declare non-primitive operations defined on
the parent type. And doing that in the public scope is almost a criminal
offense.

If we designed Ada from a fresh start I would try to eliminate all
non-primitive operations. Any operations would be either primitive or
class-wide. And a class-wide operation would be still primitive of T'Class
and thus dispatch on T'Class'Class etc.

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

  reply	other threads:[~2015-07-29  6:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-26  7:11 Why does `Unchecked_Deallocation` need the access type? EGarrulo
2015-07-26  8:54 ` Dmitry A. Kazakov
2015-07-26 11:16   ` Niklas Holsti
2015-07-27 22:38     ` Jeremiah
2015-07-27 20:20   ` Randy Brukardt
2015-07-28  7:40     ` Dmitry A. Kazakov
2015-07-28 21:25       ` Randy Brukardt
2015-07-29  6:28         ` Dmitry A. Kazakov [this message]
2015-07-29 20:47           ` Randy Brukardt
2015-07-30  6:19             ` 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