From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Suggestion: Allow functions returning abstract types in certain situations
Date: Thu, 22 May 2014 09:22:36 +0200
Date: 2014-05-22T09:22:36+02:00 [thread overview]
Message-ID: <8zl191j3jpi3.12xzqioq4t4hy.dlg@40tude.net> (raw)
In-Reply-To: wcctx8in2iu.fsf@shell01.TheWorld.com
On Wed, 21 May 2014 19:19:21 -0400, Robert A Duff wrote:
> Adam Beneschan <adambeneschan@gmail.com> writes:
>
>> Hmmm... I'd worry that if we allowed an object with an abstract-type
>> tag to exist even for a little while, something in the language
>> semantics might require Initialize, Adjust, or Finalize to be called
>> on it, which could be bad if, for example, it tried to redispatch to
>> an abstract body.
>
> 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.
Morale. Type semantics must be respected.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2014-05-22 7:22 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 [this message]
2014-05-24 18:39 ` Robert A Duff
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