comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: recursive types and generics
Date: 02 May 2003 19:12:25 +0200
Date: 2003-05-02T19:12:25+02:00	[thread overview]
Message-ID: <rw2vfwt2rye.fsf@lbrenta.corp.emc.com> (raw)
In-Reply-To: 3eb29aa6$1_3@news.arrakis.es



How about this:


procedure Test is

   generic
      type Element is private;
   package Sequence is
      type Kind_Of_Element is (Nothing, Leaf, Seq);
      type Sequence_Element (Kind : Kind_Of_Element) is private;
      type Sequence is access Sequence_Element;
   private
      type Sequence_Element (Kind : Kind_Of_Element) is record
         Next_Element : Sequence;
         case Kind is
            when Nothing => null;
            when Leaf => Payload : Element;
            when Seq => Sub_Sequence : Sequence;
         end case;
      end record;
   end Sequence;

   package My_Sequence is new Sequence (Element => Integer);
   type Seq_Access is new My_Sequence.Sequence;

begin
   null;
end Test;




      parent reply	other threads:[~2003-05-02 17:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02 16:19 recursive types and generics alfonso acosta
2003-05-02 17:09 ` Robert A Duff
2003-05-02 17:12 ` Ludovic Brenta [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