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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Introductory Ada Programming Book Date: Thu, 5 Jan 2017 01:38:00 +0100 Organization: A noiseless patient Spider Message-ID: References: <87r34j39u6.fsf@nightsong.com> <7643d59e-061f-42df-adda-9322608f127b@googlegroups.com> <5b52afcc-120e-41a5-bab2-7f5c6f647cc2@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 5 Jan 2017 00:36:29 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="edaa45db04211259f3eaac3061b62b35"; logging-data="16632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ed4cdqOujwyD4KGT21NKdutTQvrtVVVE=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 In-Reply-To: Cancel-Lock: sha1:2C7dUIwfKATZjAh26hsQzFrGmRw= Xref: news.eternal-september.org comp.lang.ada:33060 Date: 2017-01-05T01:38:00+01:00 List-Id: On 04.01.17 23:39, Niklas Holsti wrote: > > That term is one nit that could be picked, but more specifically, it is quite possible to write "case" statements using an integer type without an "others" clause. Very recently, I had occasion to write code like this: > > X : Int_Type := ... > ... > case X is > when Int_Type_T'First .. -1 => ...; > when 0 => ...; > when 1 .. Int_Type'Last => ...; > end case; Interestingly, not so recent versions of Swift will allow writing range 0...Int.max but will not make this range work. Ranges are "rewritten" from a...b to a..<(b+1). Consequently, the upper bound Int.max would have to be (Int.max+1), a value exceeding all of type Int. So, while it was possible to write case distinctions Ada style in Swift, the equivalent of Ada's Int_Type'Last has then caused issues. -- "HOTDOGS ARE NOT BOOKMARKS" Springfield Elementary teaching staff