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,db88d0444fafe8eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Date: Thu, 01 Sep 2005 15:01:16 +0200 From: Georg Bauhaus User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Surprise in array concatenation References: <1125544603.561847.32140@g47g2000cwa.googlegroups.com> <14muavojz308w.1ouv7xin79rqu$.dlg@40tude.net> <87fyspgqrm.fsf@mid.deneb.enyo.de> <4316ea4d$0$24155$9b4e6d93@newsread4.arcor-online.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4316fb6e$0$2114$9b4e6d93@newsread2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 01 Sep 2005 15:00:30 MEST NNTP-Posting-Host: d4169317.newsread2.arcor-online.net X-Trace: DXC=UM:Qc@c10PSJ<1FClJbQ`\Q5U85hF6f;TjW\KbG]kaMXQ>n?D9BSA]\:4>1GVLc9AR8JM^O\[iIdSW<9C744V=j[ X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:4370 Date: 2005-09-01T15:00:30+02:00 List-Id: Lutz Donnerhacke wrote: > * Georg Bauhaus wrote: > >>Florian Weimer wrote: >> >>>Even more problematic is the empty array whose index type >>>is an enumeration type with just one enumeration literal. >> >>This looks like a formalist's problem to me. Use subtypes: >> >> type With_Off is (Off, Only); -- two literals >> subtype The_King is With_Off range Only .. Only; -- one literal > > > You formally introduces a base type. But even this subtype fails to > construct an empty array starting on Off. This looks like a formalist's problem to me. Computer types have limited value sets, infinite types are an illusion, useful but not real. If the value is outside the range of values that can be realised inside a computer, you cannot make the value part of a terminating computation that does reference the value. So why not explicitly identify limits, if you work near the limits? One use of 'base'first, where 'base'first < 'first, is in algorithms that never reference the value at index 'base'first. Like in some Ada.Containers algorithms. In Ada.Strings.*, index value 0 is off bounds, but useful, and chosen explicitly. type String is array (Positive range <>) of Character; subtype Empty_String is String (1 .. 0); subtype Empty_String_Verbose is String (Positive'first .. Positive'pred(Positive'first));