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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ace9bff8eb84e5b1 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Generic Zero Length Array Date: Sat, 23 Feb 2008 09:27:26 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <9b771018-fb0b-42eb-ae00-12ee3eda69b2@p43g2000hsc.googlegroups.com> <2446841a-8bb0-46bc-94ed-099e4e0ca74c@k2g2000hse.googlegroups.com> <7cd05c2a-d67a-4623-a9dc-67e357877f48@e6g2000prf.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1203776846 28513 192.74.137.71 (23 Feb 2008 14:27:26 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 23 Feb 2008 14:27:26 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:iYsUhEXBHF+71BCLOeGfl0conF4= Xref: g2news1.google.com comp.lang.ada:20025 Date: 2008-02-23T09:27:26-05:00 List-Id: Adam Beneschan writes: > Way back before Ada 95, someone made a proposed language array to add > a "null array" aggregate to the language, so that you could write an > aggregate to represent a zero-element array without needing a fake > value for the elements. I thought this was a great idea and could > never understand why it wasn't adopted. It would have solved the > problem here. But the <> syntax of Ada 2005 obviates the need for > something like that. I still think it's a language design flaw that you can't write a zero-element or one-element positional aggregate. >...I don't think we need "null record" (i.e. in > aggregates) any more either, although certainly nobody is going to > suggest removing it. Why don't we need that? > [Actually, there's one case where you still can't specify a null array > aggregate, and that's where the index type is either "mod 1" or an > enumeration type with one value: > > type Enum is (This_One); > type Arr is array (Enum range <>) of Anything; > > Now go ahead and try to specify a zero-element array aggregate of type > Arr. You can't. Right. Not just aggregates -- you can't create any zero-element array of type Arr. >...But this is a pretty pathological case so it's not > worth trying to change the language for it.] If it were worth it, what would be the best change? I suppose ranges could be characterized by 'First/'Length, instead of 'First/'Last. And eliminate 'Last from the language. Or else say 'Last raises Constraint_Error if 'First = 'Base'First and 'Length = 0. - Bob