comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Unconstrained array aggregation..sq. peg into round hole?
Date: 1996/03/21
Date: 1996-03-21T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.96Mar21185700@spectre.mitre.org> (raw)
In-Reply-To: EACHUS.96Mar19201632@spectre.mitre.org

In article <DoJqI0.51n@world.std.com> bobduff@world.std.com (Robert A Duff) writes:

  > Right, except you have to give a constraint.  Array-of-unconstrained
  > array is illegal.

   Not really, but you have to put two records in the middle to make
it work:

   subtype Limited_Subscripts is Natural range 1..1000;

   type Real_Array is array (Limited_Subscripts range <>) of Float;

   type Inner_Wrapper is (First: Integer := 1; Last: Integer := 0) is record
     B: Real_Array(First..Last);
   end record;

   type Outer_Wrapper is 
     A: Inner_Wrapper;
   end record;
 
   type Ragged_Table is array (Natural range <>) of Outer_Wrapper;

   I never understood why, if this useful and used feature was in Ada
83 and Ada 95, you have to go through all this semantic sugar to create
the ragged array type.  To keep novice users from trying it?   

   (The Limited_Subscripts subtype is so that this will work on all
implementations including those that "allocate the maximum" for this
type of subcomponent.)

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  parent reply	other threads:[~1996-03-21  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-17  0:00 Unconstrained array aggregation..sq. peg into round hole? David Weller
1996-03-19  0:00 ` Ted Dennison
1996-03-19  0:00   ` Robert Dewar
1996-03-19  0:00 ` Unconstrained array aggregation..sq. peg i John Hutchison x2141
1996-03-20  0:00 ` Unconstrained array aggregation..sq. peg into round hole? Jon S Anthony
1996-03-20  0:00   ` David Weller
1996-03-20  0:00 ` Robert I. Eachus
1996-03-20  0:00   ` Robert A Duff
1996-03-20  0:00     ` Keith Thompson
1996-03-21  0:00   ` Robert I. Eachus [this message]
1996-03-22  0:00     ` Robert Dewar
1996-03-25  0:00   ` Robert I. Eachus
1996-03-25  0:00     ` Robert Dewar
replies disabled

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