comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Allocate an array of a record with a discriminant?
Date: Sat, 31 Mar 2001 04:22:43 GMT
Date: 2001-03-31T04:22:43+00:00	[thread overview]
Message-ID: <wccy9tmk1nw.fsf@world.std.com> (raw)
In-Reply-To: oy4x6.647107$U46.19927727@news1.sttls1.wa.home.com

"Mark Lundquist" <mark@rational.com> writes:

> > type Words (Max_Word_Length : Integer) is array (Natural range <>) of Word
> > (Max_Word_Length);
> 
> You're right, an array type can't be a discriminated type (remember, a
> discriminant is a special kind of component, and while that fits into the
> idea of a record -- which has named components of arbitrary types -- it
> doesn't fit into the idea of an array, where all the components are of the
> same type and all are indexable over a range).

I think it makes perfect sense for arrays to have discriminants.  It
just happens that Ada doesn't allow it.  In fact, I would say that if
array bounds and discriminants were treated as the same thing, the
language would be simplified.

I realize this doesn't answer the original question -- but you did that
quite nicely in the rest of your posting (which I snipped).

- Bob



  reply	other threads:[~2001-03-31  4:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-27 15:41 Allocate an array of a record with a discriminant? Joe
2001-03-27 20:22 ` Robert A Duff
2001-03-27 21:11 ` tmoran
2001-03-30 18:48 ` Mark Lundquist
2001-03-31  4:22   ` Robert A Duff [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-27 19:44 Beard, Frank
replies disabled

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