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!feeder.eternal-september.org!aioe.org!.POSTED.yTvCNOh9TRCAIcX40YItlQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: class wide iterable (and indexable) Date: Tue, 29 Jan 2019 21:26:18 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: yTvCNOh9TRCAIcX40YItlQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 X-Notice: Filtered by postfilter v. 0.9.1 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:55404 Date: 2019-01-29T21:26:18+01:00 List-Id: On 2019-01-29 20:34, Niklas Holsti wrote: > Another approach to the same (?) could be to allow enumerated types > where the literals are integers, as in: > >    type Odd is (1, 3, 5, 7, 9);  -- NOT current Ada! What is the semantics of this? Is Odd'(3) = Odd'(1) + Odd'(1) + Odd'(1). No? > Of course one would have to be careful how (and if) the arithmetic > operators are defined for "integer enumeration" types. One should start with this question. What is the type structure one want to create. How many people need that kind of thing. Why language should support it. A much easier approach is just not to bother. Simply provide user-defined literals, sane interface inheritance, reasonable statically enforced contracts, ADT in short. Leave the rest to the programmer. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de