comp.lang.ada
 help / color / mirror / Atom feed
From: alfonso acosta <alfonso_acosta_mail@yahoo.es>
Subject: recursive types and generics
Date: Fri, 02 May 2003 18:19:50 +0200
Date: 2003-05-02T18:19:50+02:00	[thread overview]
Message-ID: <3eb29aa6$1_3@news.arrakis.es> (raw)

Hi:

I need to code a recursive type: a Sequence which could contain 
sequences of the same type. Im trying to use a generic package for that 
purpouse. I provide a simplified example:

-------------------------------------------------------------------------
type Elem_Type is (Nothing, Int, Seq);

type Seq_Acces;

type Seq_Elem (Const : Elem_Type := Nothing) is
    record
      case Const is
        when Nothing => null;
        when Int     => I : Integer;
        when Seq     => S : Seq_Access;
         -- "invalid use of type before its full declaration"
      end case;
    end record;

package Myseq is new Sequence (Element => Seq_Elem);

type Seq_Access is access Myseq.Sequence; -- provided by the generic
                                           -- package
--------------------------------------------------------------------------

Any ideas about fixing it?

Alfonso Acosta




             reply	other threads:[~2003-05-02 16:19 UTC|newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox