comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: syntaxic exploration
Date: Sat, 23 Dec 2017 19:37:40 -0800 (PST)
Date: 2017-12-23T19:37:40-08:00	[thread overview]
Message-ID: <e28313e0-9b44-495d-85d9-2ae08e70339a@googlegroups.com> (raw)
In-Reply-To: <p1lvu2$ve9$1@dont-email.me>

On Saturday, December 23, 2017 at 11:23:32 AM UTC-5, Jeffrey R. Carter wrote:
> On 12/22/2017 11:11 PM, Niklas Holsti wrote:
> > 
> > I think the aggregate form (null array) was suggested some time ago, in analogy 
> > with the existing (null record). It looks good to me, but as I remember, there 
> > was some objection. One problem is that if the index type has exactly one value, 
> > then a null array with that index type cannot exist (because then A'First = 
> > A'Last for any such array A).
> 
> Actually, a null array of such a type can exist if it's a string type, because 
> you can use the string literal "" for such types. AIUI, 'Last is undefined for 
> such a value. Allowing (null array) for non-string array types with an index 
> type with a single value would presumably work the same.

The rule that allows 1..0 as a null string range only has a problem if you have an array with an enumeration index type containing a single component.  I think that is one of those cases where we say, "Don't do that!" and move on.

A more complex, and potentially ugly case is for multidimensional arrays.  Defining (null array) as being empty in all dimensions with Foo'Range(n) = Bar'First..Bar'Pred(Bar'First) where Bar is the nth index SUBtype for Foo works.  If the last materialized is a (real) Numeric_Error AKA Constraint_Error?  Again, only an issue for smart alecks. In general, you should be surprised if Foo'Last(N) for a null array doesn't raise Constraint_Error.


  reply	other threads:[~2017-12-24  3:37 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 17:28 syntaxic exploration Mehdi Saada
2017-12-20 17:32 ` Mehdi Saada
2017-12-20 20:08   ` Niklas Holsti
2017-12-20 22:18     ` Mehdi Saada
2017-12-20 22:45       ` Mehdi Saada
2017-12-21  7:24         ` Randy Brukardt
2017-12-21  7:44           ` Niklas Holsti
2017-12-21  7:21   ` Randy Brukardt
2017-12-21 16:24     ` Jeffrey R. Carter
2017-12-22  5:01       ` Robert Eachus
2017-12-22 21:15         ` Simon Clubley
2017-12-22 22:11           ` Niklas Holsti
2017-12-22 22:51             ` Dmitry A. Kazakov
2017-12-23  7:15               ` Niklas Holsti
2017-12-23 16:23             ` Jeffrey R. Carter
2017-12-24  3:37               ` Robert Eachus [this message]
2017-12-24 13:39                 ` Niklas Holsti
2017-12-24 13:32               ` Niklas Holsti
2017-12-25 13:40                 ` Jeffrey R. Carter
2017-12-25 14:42                   ` Mehdi Saada
2017-12-25 17:03                     ` Dmitry A. Kazakov
2017-12-25 18:27                     ` Niklas Holsti
2017-12-25 20:12                     ` Jacob Sparre Andersen
2017-12-20 20:05 ` Niklas Holsti
2017-12-20 22:48 ` Mehdi Saada
2017-12-20 23:39   ` Mehdi Saada
2017-12-21  0:35 ` Mehdi Saada
2017-12-21  7:18 ` Randy Brukardt
2017-12-21 19:23   ` G. B.
2017-12-21 23:46   ` bj.mooremr
2017-12-22 23:45     ` Randy Brukardt
2017-12-22 13:31 ` Mehdi Saada
2017-12-22 18:00   ` Mehdi Saada
2017-12-22 18:27   ` Niklas Holsti
2017-12-22 20:25     ` Mehdi Saada
2017-12-22 22:33       ` Niklas Holsti
2017-12-23  1:47 ` Mehdi Saada
2017-12-23  7:17   ` Niklas Holsti
2017-12-23 11:23     ` Mehdi Saada
2017-12-23 11:39       ` Mehdi Saada
2017-12-23 12:09         ` Niklas Holsti
2017-12-23 12:12 ` Mehdi Saada
2017-12-23 12:16   ` Mehdi Saada
2017-12-23 13:04     ` Niklas Holsti
2017-12-23 14:02       ` Mehdi Saada
2017-12-23 14:46         ` Mehdi Saada
2017-12-23 15:03           ` Mehdi Saada
2017-12-23 22:11             ` Niklas Holsti
2017-12-24  0:55               ` Mehdi Saada
replies disabled

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