From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class
Date: Mon, 12 Feb 2018 19:24:47 +0100
Date: 2018-02-12T19:24:47+01:00 [thread overview]
Message-ID: <p5sm5g$1be7$1@gioia.aioe.org> (raw)
In-Reply-To: ff42cf51-b24b-4a31-b30b-033855e84576@googlegroups.com
On 2018-02-12 19:17, Mehdi Saada wrote:
> ... Somehow, it doesn't surprise me anymore.
>
>> Get_Elem take T_Token'Class
> How could I do that, since it meant to RETURN a different type for each subclass !
1. Class /= type. Class is a set of types rooted in a type.
2. T'Class is meant to have values of/equivalent to values of all these
different types.
3. You can always convert a member of the class (a specific type) to the
class-wide type of any class this specific type belongs to.
type T is ...;
type S is new T with ...;
function Foo return T'Class is
Result : S;
begin
return T'Class (Result); -- This is OK
end Foo;
> Now, I know why I prefered mutant types even before using them.
Mutable instances are always less safe than immutable ones.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2018-02-12 18:24 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 16:29 troubles learning OOP: expected type "Parent.Some_Child", found type Parent'Class Mehdi Saada
2018-02-12 17:44 ` Jeffrey R. Carter
2018-02-12 18:17 ` Mehdi Saada
2018-02-12 18:24 ` Dmitry A. Kazakov [this message]
2018-02-12 18:42 ` Simon Wright
2018-02-12 20:25 ` Jeffrey R. Carter
2018-02-12 21:18 ` Mehdi Saada
2018-02-12 22:40 ` Simon Wright
2018-02-12 23:12 ` Mehdi Saada
2018-02-13 8:00 ` Stephen Leake
2018-02-13 17:42 ` Jeffrey R. Carter
2018-02-13 17:56 ` Dmitry A. Kazakov
2018-02-12 21:19 ` Mehdi Saada
2018-02-12 18:40 ` Simon Wright
2018-02-12 21:39 ` Mehdi Saada
2018-02-12 21:43 ` Mehdi Saada
2018-02-12 22:22 ` Mehdi Saada
2018-02-13 17:46 ` Jeffrey R. Carter
2018-02-13 20:19 ` Mehdi Saada
2018-02-13 21:24 ` Bojan Bozovic
2018-02-13 23:03 ` Mehdi Saada
2018-02-13 23:03 ` Mehdi Saada
2018-02-14 7:00 ` Bojan Bozovic
2018-02-14 12:04 ` Mehdi Saada
2018-02-16 23:40 ` Mehdi Saada
2018-02-17 1:13 ` Mehdi Saada
2018-02-13 0:01 ` Mehdi Saada
2018-02-13 0:42 ` Mehdi Saada
2018-02-13 1:32 ` Mehdi Saada
2018-02-13 4:16 ` Bojan Bozovic
2018-02-13 11:28 ` Simon Wright
2018-02-13 12:03 ` Mehdi Saada
2018-02-13 13:25 ` Dmitry A. Kazakov
2018-02-19 18:10 ` Mehdi Saada
2018-02-19 18:16 ` Simon Clubley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox