comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Half Constrained Array Types and Slices
Date: Fri, 10 Mar 2006 22:24:30 +0100
Date: 2006-03-10T22:24:28+01:00	[thread overview]
Message-ID: <devwot66jydx.5zcurmfila3t.dlg@40tude.net> (raw)
In-Reply-To: wccr75aurut.fsf@shell01.TheWorld.com

On 10 Mar 2006 12:33:46 -0500, Robert A Duff wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> 
>> There is, but for most of finite bounds a string range would contain an
>> uncountable number of items. For example "A".."B". This range includes
>> "AA", "AAA", etc. This might be is undesirable, however, it would be
>> interesting to think about how to deal with bounded infinite ranges, like
>> "A".."B".
> 
> Note quite infinite, since X'Last <= Natural'Last for all Strings X.
> And I suppose the highest value of String is:
> 
>     (Positive => Character'Last)
> 
> This leads nowhere useful!  ;-)

OK, but "universal string" indexed by universal integer are truly infinite.
(:-))

> If you want "arrays" indexed by strings, you really want sparse arrays
> implemented as hash tables or some such.  I call those "mappings", not
> "arrays".

Can't a map have indexing operation? Should indexing always imply ranges?

I think the visible interface of the corresponding index type should
determine whether ranges exist. If Map'Index'Succ isn't defined, then there
is no Map'Range and, so it is not an ordered container.

>>... After all [universal] floating-point ranges are allowed in Ada,
>> and they aren't finite...
> 
> And they're not allowed in 'for' loops, nor as array indices.
> Which is a good thing.

Nevertheless they exist. So there should be a rational answer why 0.0..1.0
is legal, but "A".."B" is not.

BTW, that the range bounds may be outside the range they specify, is not
unique for enumeration types. A similar thing shows itself for fixed point
types: delta ... range 0.0..1.0; It seems that the problem lies deeper...

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



  reply	other threads:[~2006-03-10 21:24 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
2006-03-10  8:46             ` Dmitry A. Kazakov
2006-03-10 17:33               ` Robert A Duff
2006-03-10 21:24                 ` Dmitry A. Kazakov [this message]
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