* Use of abstract tagged types without access types
@ 2011-06-09 17:44 Prof. Dr. Carl Weierstrass
2011-06-10 6:53 ` AdaMagica
2011-06-12 5:51 ` Yannick Duchêne (Hibou57)
0 siblings, 2 replies; 5+ messages in thread
From: Prof. Dr. Carl Weierstrass @ 2011-06-09 17:44 UTC (permalink / raw)
Hi,
I have a question to all Ada gurus:
I want to do something like:
package Test is
type Parent_Type is new Ada.Finalization.Controlled with private;
type Child_Type is abstract new Ada.Finalization.Controlled with
private;
type Child_Type_1 is new Child_Type with private;
type Child_Type_N is new Child_Type with private;
private
type Parent_Type is new Ada.Finalization.Controlled with record
Child : Child_Type'Class;
end record;
type Child_Type is abstract new Ada.Finalization.Controlled with
null record;
type Child_Type_1 is new Child_Type with null record;
type Child_Type_N is new Child_Type with null record;
end Test;
This doesn't work, because:
class-wide subtype with unknown discriminants in component declaration
Of course I could
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Use of abstract tagged types without access types
2011-06-09 17:44 Use of abstract tagged types without access types Prof. Dr. Carl Weierstrass
@ 2011-06-10 6:53 ` AdaMagica
2011-06-10 7:17 ` Simon Wright
2011-06-12 5:51 ` Yannick Duchêne (Hibou57)
1 sibling, 1 reply; 5+ messages in thread
From: AdaMagica @ 2011-06-10 6:53 UTC (permalink / raw)
On 9 Jun., 19:44, "Prof. Dr. Carl Weierstrass"
<carl.weierstr...@googlemail.com> wrote:
> type Parent_Type is new Ada.Finalization.Controlled with record
Child : access Child_Type'Class; -- You definitely need an
access here...
> end record;
>
> Of course I could
... as (I'm sure) you wanted to say here. Tags are some kind of
(hidden) discriminant.
Alternatively:
type Parent_Type (<>) --(Child: access Child_Type'Class)
is new Ada.Finalization.Controlled with private;
private
type Parent_Type (Child: access Child_Type'Class)
is new Ada.Finalization.Controlled with null record;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Use of abstract tagged types without access types
2011-06-09 17:44 Use of abstract tagged types without access types Prof. Dr. Carl Weierstrass
2011-06-10 6:53 ` AdaMagica
@ 2011-06-12 5:51 ` Yannick Duchêne (Hibou57)
1 sibling, 0 replies; 5+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-06-12 5:51 UTC (permalink / raw)
Le Thu, 09 Jun 2011 19:44:05 +0200, Prof. Dr. Carl Weierstrass
<carl.weierstrass@googlemail.com> a écrit:
> type Parent_Type is new Ada.Finalization.Controlled with record
> Child : Child_Type'Class;
> end record;
That looks a strange design to my eyes, just like if you were to reinvent
the concept of class-wide type.
I would enjoy enough to know the finality of this design.
--
“Syntactic sugar causes cancer of the semi-colons.” [Epigrams on
Programming — Alan J. — P. Yale University]
“Structured Programming supports the law of the excluded muddle.” [Idem]
“c++; /* this makes c bigger but returns the old value */” [Anonymous]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-12 5:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 17:44 Use of abstract tagged types without access types Prof. Dr. Carl Weierstrass
2011-06-10 6:53 ` AdaMagica
2011-06-10 7:17 ` Simon Wright
2011-06-10 9:42 ` AdaMagica
2011-06-12 5:51 ` Yannick Duchêne (Hibou57)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox