comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada 95 and Class attribute for none-tagged incomplete type
Date: Mon, 3 Aug 2009 20:45:02 +0200
Date: 2009-08-03T20:45:03+02:00	[thread overview]
Message-ID: <7cjtueuadh5r.17j3l3w6zv1s3$.dlg@40tude.net> (raw)
In-Reply-To: 17b5de2e-74df-414a-b214-677344dc697e@x25g2000prf.googlegroups.com

On Mon, 3 Aug 2009 08:26:24 -0700 (PDT), Adam Beneschan wrote:

> Keep in mind that this isn't a privacy issue.  The main reason for
> incomplete types is so that you can declare linked lists and things
> like that.  Allowing a 'Class reference to a type not yet declared as
> tagged allowed things like this:
> 
>    type Rec;
>    type Rec_Acc is access all Rec'Class;
>    type Rec is tagged record
>        ...
>        Next : Rec_Acc;
>    end record;
> 
> so that you could have a heterogeneous list of records.

Well, I would argue that logically the above could be rather:

   type Rec;
   type Rec_Acc is access all Rec;
   type Rec'Root is tagged record
       ...
      Next : Rec_Acc;
   end record;

Here 'Root is defined so that T'Class'Root = T. So Rec is class-wide.

Of course, from the stand point that any type has a class rooted in it,
Rec'Class is fully OK. But if we wanted further to pretend that some types
are more "classy" than others, we could maintain such distinction in a way
like above.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-08-03 18:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-02  6:55 Ada 95 and Class attribute for none-tagged incomplete type Hibou57 (Yannick Duchêne)
2009-08-03 15:26 ` Adam Beneschan
2009-08-03 18:45   ` Dmitry A. Kazakov [this message]
2009-08-13  1:50   ` Randy Brukardt
2009-08-13  8:18     ` Niklas Holsti
2009-08-13 13:16       ` Robert A Duff
2009-08-14  4:21         ` Randy Brukardt
2009-08-14 19:01           ` Robert A Duff
2009-08-14 23:41             ` Randy Brukardt
2009-08-15 14:33               ` Robert A Duff
2009-08-14  4:17       ` Randy Brukardt
replies disabled

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