comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Smart Pointers and Tagged Type Hierarchies
Date: Tue, 1 Aug 2017 17:41:00 -0500
Date: 2017-08-01T17:41:00-05:00	[thread overview]
Message-ID: <olr01t$e57$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: olpb12$1o3$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:olpb12$1o3$1@gioia.aioe.org...
> On 2017-08-01 05:43, Randy Brukardt wrote:
...
>> One would have to have some form of multiple dispatch to get around that,
>> but that's a bridge too far for a language that's mainly used in 
>> embedded,
>> safety-critical systems.
>
> But Ada already has this form of multiple-dispatch. The issue does not 
> requires two types. Two controlling parameters of the same type is just 
> enough:
>
>    type T is tagged ...
>    procedure Foo (X, Y : T);
>
>    type S is new T with ...
>    overriding procedure Foo (X, Y : S);
>
>    X : T'Class := T'(...);
>    Y : T'Class := S'(...);
> begin
>    Foo (X, Y);
>
> So I would not be much concerned about that.

This is described (and implemented) as a single dispatch with a tag equality 
check. Nothing multiple about it outside of the initial appearance.

To use that mechanism implies that you have only one type (and a shared tag) 
as opposed to two different but related types. I'm not sure how that could 
work, given the very different properties of a reference vs. an object type. 
It also would require some relaxation of the "one controlling type per 
primitive subprogram" rule. I suspect both of those would run into trouble 
with the generic contract model (specifically with generic derived types), 
but someone would have to try to work out all of the details in order to be 
sure.

                                 Randy.




  reply	other threads:[~2017-08-01 22:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 15:41 Smart Pointers and Tagged Type Hierarchies Felix Krause
2017-07-24 19:53 ` Dmitry A. Kazakov
2017-07-27 19:30   ` Felix Krause
2017-07-27 20:42     ` Dmitry A. Kazakov
2017-07-24 21:24 ` Chris Moore
2017-07-27 19:38   ` Felix Krause
2017-08-01  4:07     ` Randy Brukardt
2017-07-26 17:53 ` Ivan Levashev
2017-07-28  9:21 ` AdaMagica
2017-07-30 19:45   ` briot.emmanuel
2017-08-01  3:43 ` Randy Brukardt
2017-08-01  7:36   ` Dmitry A. Kazakov
2017-08-01 22:41     ` Randy Brukardt [this message]
2017-08-02  6:28       ` Dmitry A. Kazakov
2017-08-02 19:26         ` Randy Brukardt
replies disabled

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