From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: syntaxic exploration Date: Sat, 23 Dec 2017 00:11:49 +0200 Organization: Tidorum Ltd Message-ID: References: <0d33e631-e63d-4346-ac95-5eec72127f4f@googlegroups.com> <0fa75dd5-599b-4a38-a5d4-3151bbe5172f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net vr99hjVjtGAy/ENTYMRjhQSwoaSj4Z1wnvPQKHB53fyzQqrE09 Cancel-Lock: sha1:lLJjc2AIWuniAdhdIoMf6Rc7lmY= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Xref: reader02.eternal-september.org comp.lang.ada:49595 Date: 2017-12-23T00:11:49+02:00 List-Id: On 17-12-22 23:15 , Simon Clubley wrote: > On 2017-12-22, Robert Eachus 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 . @ .