From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: abstract types and subprograms
Date: Tue, 20 May 2014 16:11:53 +0200
Date: 2014-05-20T16:11:53+02:00 [thread overview]
Message-ID: <ojc482edp8wb.12cbvzlvxph2v.dlg@40tude.net> (raw)
In-Reply-To: llfhpb$ka4$1@speranza.aioe.org
On Tue, 20 May 2014 15:28:29 +0300, Victor Porton wrote:
> Dmitry A. Kazakov wrote:
>
>> function From_Handle(Handle: Dummy_Record_Access) return
>> Base_Object'Class;
>>
>> Logically, a handle can point on an object of any type derived from
>> Base_Object, so it is a class.
>
> But can this:
>
> function From_Handle(Handle: Dummy_Record_Access) return Base_Object is
> (Ada.Finalization.Limited_Controlled with Handle=>Handle);
>
> be implemented if the return type changes to Base_Object'Class?
It does not make sense to me. Probably because it is not clear what you are
going to achieve, smart pointer, an opaque handle to a C object, no idea.
> It seems that returning Base_Object'Class wouldn't magically make it work
> (without explicit override).
Either you override or you don't. As I said, the criterion is whether the
implementation is same for all class or different for some instances.
> Or can it be done implementing Frorm_Handle only once (for Base_Object) with
> automatic changing its signature for derived tagged types?
Signature changes if the operation is primitive. It does not change if it
is not primitive, e.g. class-wide.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
prev parent reply other threads:[~2014-05-20 14:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 10:22 abstract types and subprograms Victor Porton
2014-05-20 10:51 ` mockturtle
2014-05-20 11:45 ` Victor Porton
2014-05-20 16:27 ` Robert A Duff
2014-05-20 19:52 ` Dmitry A. Kazakov
2014-05-24 18:49 ` Robert A Duff
2014-05-24 19:41 ` Dmitry A. Kazakov
2014-05-20 11:55 ` Dmitry A. Kazakov
2014-05-20 12:28 ` Victor Porton
2014-05-20 14:11 ` Dmitry A. Kazakov [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox