From: "G.B." <bauhaus@futureapps.invalid>
Subject: Re: Declaring constants for a abstract tagged type and concrete sub classes
Date: Tue, 7 Jul 2015 19:21:44 +0200
Date: 2015-07-07T19:21:44+02:00 [thread overview]
Message-ID: <mnh1ok$r6r$1@dont-email.me> (raw)
In-Reply-To: <d191bb4e-0feb-4a7e-af27-db78721f6f68@googlegroups.com>
On 07.07.15 18:27, Serge Robyns wrote:
> Now I'm facing my other issue, how to "merge" the root and child part in a new No_Element ... This is about valid Ada syntax.
> No_Element : constant T_Concrete := ( T_Root.No_Element, 789);
If the derived type stays within the package hierarchy,
i.e. in a child package (that's Abstract_Root.No_Element
in the extension aggregate):
...
private
No_Element : constant Non_Abstract :=
Non_Abstract'(No_Element with
Abc => -42);
That is, one can start an extension aggregate with
an expression supplying the T_Root stuff from the parent
type. Or,
...
private
No_Element : constant Non_Abstract :=
Non_Abstract'(T_Root with
Abc => -42);
where T_Root stands for the type's defaults only.
Outside the hierarchy, that could be
...
private
No_Element : constant Non_Abstract :=
Non_Abstract'(Abstract_Root.T_Root with
Abc => -42);
This presumes, then, that no_element-ness is fully determined
by the component Abc here, since Abstract_Root.No_Element's
private view is unavailable outside the package hierarchy
and so can't be depended upon.
next prev parent reply other threads:[~2015-07-07 17:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 10:10 Declaring constants for a abstract tagged type and concrete sub classes Serge Robyns
2015-07-06 11:55 ` G.B.
2015-07-06 13:49 ` Serge Robyns
2015-07-06 17:36 ` G.B.
2015-07-07 16:27 ` Serge Robyns
2015-07-07 17:21 ` G.B. [this message]
2015-07-07 19:51 ` Serge Robyns
2015-07-07 20:14 ` Simon Wright
2015-07-07 20:18 ` Jeffrey R. Carter
2015-07-06 15:42 ` Simon Wright
2015-07-06 16:35 ` Serge Robyns
2015-07-06 17:02 ` Bob Duff
2015-07-06 21:16 ` Serge Robyns
2015-07-06 17:30 ` gautier_niouzes
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox