comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Suggestion: Allow functions returning abstract types in certain situations
Date: Sat, 24 May 2014 14:39:12 -0400
Date: 2014-05-24T14:39:12-04:00	[thread overview]
Message-ID: <wccwqdbdnsf.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 8zl191j3jpi3.12xzqioq4t4hy.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On Wed, 21 May 2014 19:19:21 -0400, Robert A Duff wrote:
>> Not sure what you mean about "redispatch".  You can't [re]dispatch
>> without converting to class-wide.
>
> Actually you can:
>
> 1. The Rosen's trick. You put a class-wide access discriminant into the
> abstract type and dispatch on it.
>
> 2. Consider:
>
>    type T is tagged ...;  -- Non-abstract
>    type S is abstract new T with ...; -- Abstract
>
> You convert to T, then that to T'Class and then dispatch on that. Never
> needed S'Class to make it crash.

Good points.  I still think it could work, given certain restrictions.
I should have said, "You can't [re]dispatch without obtaining a
class-wide view."  That's what would need to be prevented.

> Morale. Type semantics must be respected.

?

- Bob


  reply	other threads:[~2014-05-24 18:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 14:52 Suggestion: Allow functions returning abstract types in certain situations Victor Porton
2014-05-21 16:10 ` Adam Beneschan
2014-05-21 19:09   ` Dan'l Miller
2014-05-21 22:09     ` Robert A Duff
2014-05-21 22:29       ` Adam Beneschan
2014-05-21 22:04   ` Robert A Duff
2014-05-21 22:33     ` Adam Beneschan
2014-05-21 23:19       ` Robert A Duff
2014-05-22  7:22         ` Dmitry A. Kazakov
2014-05-24 18:39           ` Robert A Duff [this message]
2014-05-24 19:20             ` Dmitry A. Kazakov
2014-05-22 14:47         ` Adam Beneschan
2014-05-24 18:45           ` Robert A Duff
replies disabled

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