From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Suggestion: Allow functions returning abstract types in certain situations
Date: Wed, 21 May 2014 18:09:00 -0400
Date: 2014-05-21T18:09:00-04:00 [thread overview]
Message-ID: <wccoayqzsw3.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: a8c0fb07-bb62-4db8-a622-058422145bcb@googlegroups.com
"Dan'l Miller" <optikos@verizon.net> writes:
> The size of an abstract type is not known in this situation.
The size of the abstract type is know from the (possibly private) record
or record extension.
>> package Pack1 is
>> type T1 is abstract tagged record ... end record;
>> function Func (X : Integer) return T1; -- not currently legal
>
> This whole topic seems to be going nowhere fast. The size of T1's
> eventual concrete type (i.e., some member of T1'Class) cannot be known
> by Func (nor in general by callers of Func). There could be many such
> eventual concrete types of T1; hence the insurmountable question will
> always be: which member of T1'Class was instantiated concretely?
No, no, I think you are misunderstanding the suggested language change.
Func is returning a T1, whose size is perfectly well known to the
compiler. It's not returning some other member of T1'Class.
Anyway, this:
function Class_Wide_Func (X : Integer) return T1'Class; -- currently legal
IS legal, and it CAN return an object whose tag is anything
in the class. The size in this case is determined at the
"return" in the body.
- Bob
next prev parent reply other threads:[~2014-05-21 22:09 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 [this message]
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
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