comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Are mutually dependant and possibly recursive types using Containers possible?
Date: Fri, 9 Sep 2016 13:40:17 -0700
Date: 2016-09-09T13:40:17-07:00	[thread overview]
Message-ID: <nqv6nf$ebn$1@dont-email.me> (raw)
In-Reply-To: <d63f492e-bb6b-4861-a4a3-55c060b3d913@googlegroups.com>

On 09/09/2016 01:24 PM, Shark8 wrote:
> 
> We could add Strings easily enough:
>  Package String_Holder is new Ada.Containers.Indefinite_Holders( String );
>  
>  Type Type_Indicator is ( TI_Integer, TI_Real, TI_String );
>  
>  Type Item( Indicator : Type_Indicator ) is record
>     case Indicator is
>         when TI_Integer => Integer_Value : Integer;
>         when TI_Real    => Real_Value    : Float;
>         when TI_String  => String_Value  : String_Holder.Holder;
>     end case;
>  end record;
> 
> But with adding arrays things break down:
> we can't instantiate Ada.Containers.Indefinite_Vectors for use in Item because Item isn't defined at that point, yet we absolutely need it in order to make it (the structure/definition) simple.

Somebody named Shark8 asked this July 30:

https://groups.google.com/forum/#!msg/comp.lang.ada/Brf7vvOLvrQ/fQB6RUzZAgAJ;context-place=forum/comp.lang.ada

I'm not sure what was wrong with the solution you got there then, since you
didn't respond to any of the replies, but my solution is still to make Item a
type extension of a dummy tagged type Root, and instantiate Indefinite_Vectors
with Root'Class.

-- 
Jeff Carter
"In the frozen land of Nador they were forced to
eat Robin's minstrels, and there was much rejoicing."
Monty Python & the Holy Grail
70

      reply	other threads:[~2016-09-09 20:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 20:24 Are mutually dependant and possibly recursive types using Containers possible? Shark8
2016-09-09 20:40 ` Jeffrey R. Carter [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