From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: syntaxic exploration
Date: Sat, 23 Dec 2017 00:11:49 +0200
Date: 2017-12-23T00:11:49+02:00 [thread overview]
Message-ID: <fa5e95Fr2nkU1@mid.individual.net> (raw)
In-Reply-To: <p1jsl6$1b4$1@dont-email.me>
On 17-12-22 23:15 , Simon Clubley wrote:
> On 2017-12-22, Robert Eachus <rieachus@comcast.net> wrote:
>> On Thursday, December 21, 2017 at 11:24:54 AM UTC-5, Jeffrey R. Carter wrote:
>>> On 12/21/2017 08:21 AM, Randy Brukardt wrote:
>>>>
>>>> Ada has no good way to write an empty array. I usually use (1 .. 0 => <>)
>>>> for that, but nothing is really satisfying.
>>>
>>> Except perhaps the empty array aggregate
>>>
>>> ""
>>>
>>> (only for string types, alas).
>>
>> Is it a reasonable language improvement request to allow "" for other
>> empty arrays?
>
>
> No. That would be too confusing IMHO because it would initially appear
> to be a string type to anyone unfamiliar with that part of the code
> and that just feels _way_ wrong.
I agree.
>> Another possibility is the reserved word null.
[snip]
> null is an interesting option for the empty array. However, for your
> strings idea, would people unfamiliar with the code and this new usage
> of null read this new usage as a null pointer instead of an empty string ?
> That could be confusing.
I agree, again.
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).
> The 1..0 notation is ugly but anyone who sees it knows instantly
> exactly what the original programmer meant.
Yes, but it becomes rather more ugly if the index type is an
enumeration, or a generic formal discrete type, something like
Thingummybob'Succ (Thingummybob'First) .. Thingummybob'First
Note that Thingummybob'Last .. Thingummybob'First won't be a null range
if Thingummybob has exactly one value.
> Any cleaner replacement
> should instantly come across as the empty array without the
> possibility of confusion because someone reused Ada syntax
> for this in an ambiguous way.
I think (null array) satisfies that. I wish it could be introduced.
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
next prev parent reply other threads:[~2017-12-22 22:11 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 [this message]
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
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