comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: Half Constrained Array Types and Slices
Date: Fri, 10 Mar 2006 04:28:59 GMT
Date: 2006-03-10T04:28:59+00:00	[thread overview]
Message-ID: <fg7Qf.2239$x94.1238@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <wcc64mnw8hv.fsf@shell01.TheWorld.com>

Robert A Duff wrote:
> 
> I don't quite see the point of this.  If 'Length = 0,
> it seems to me, then the index type must be some sort of integer,
> or something like that.  It depends on how far afield you want
> to go.  For example, do you like "array(String range <>) of Integer"?
> There's no _range_ there...

I think the index type should be discrete. But surely it doesn't need to be an 
integer:

with Ada.Text_IO;
procedure Null_Range is
    type A is (B, C);

    type D is array (A range <>) of Integer;

    E : D (C .. B);
begin -- Null_Range
    Ada.Text_IO.Put_Line (Item => A'Image (E'Last) );
end Null_Range;

This is valid Ada. With GNAT, it outputs B. However, if D were a string type, "" 
would not be valid for it.

> The idea that 'Range is equivalent to 'First..'Last seems reasonable to
> me...

I'm not saying it's a good idea. I'm just wondering what the consequences of it are.

-- 
Jeff Carter
"Crucifixion's a doddle."
Monty Python's Life of Brian
82



  reply	other threads:[~2006-03-10  4:28 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-02  5:00 Half Constrained Array Types and Slices Jeffrey R. Carter
2006-03-02  8:34 ` Dmitry A. Kazakov
2006-03-02 15:34   ` Georg Bauhaus
2006-03-02 19:37     ` Dmitry A. Kazakov
2006-03-02 20:06   ` Jeffrey R. Carter
2006-03-02 20:37     ` Dmitry A. Kazakov
2006-03-02 21:01     ` Robert A Duff
2006-03-02 20:40   ` Robert A Duff
2006-03-02 14:32 ` Larry Kilgallen
2006-03-02 20:08   ` Jeffrey R. Carter
2006-03-02 20:48   ` Robert A Duff
2006-03-06  2:16     ` Larry Kilgallen
2006-03-06 18:50       ` Martin Krischik
2006-03-02 20:38 ` Robert A Duff
2006-03-03  5:15   ` Jeffrey R. Carter
2006-03-03  8:57     ` Dmitry A. Kazakov
2006-03-03 23:41     ` Robert A Duff
2006-03-06 17:50       ` Jeff Carter
2006-03-06 18:31         ` Dmitry A. Kazakov
2006-03-07 19:02           ` Jeff Carter
2006-03-08 14:29             ` Dmitry A. Kazakov
2006-03-09 22:44               ` Robert A Duff
2006-03-10  8:46                 ` Dmitry A. Kazakov
2006-03-06 19:49         ` Stefan Lucks
2006-03-08 17:36         ` brian.b.mcguinness
2006-03-08 17:56           ` Jeff Carter
2006-03-09 22:36         ` Robert A Duff
2006-03-10  4:28           ` Jeffrey R. Carter [this message]
2006-03-10  8:46             ` Dmitry A. Kazakov
2006-03-10 17:33               ` Robert A Duff
2006-03-10 21:24                 ` Dmitry A. Kazakov
2006-03-10 17:38             ` Robert A Duff
2006-03-11  0:19               ` Randy Brukardt
2006-03-11  1:43                 ` Jeffrey R. Carter
2006-03-11  8:38                   ` Niklas Holsti
replies disabled

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