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 X-Google-Thread: a07f3367d7,421379614df5a9cd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Range excluding 0.0 Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <6f1ce89e-7889-4d58-b0f8-1945727f5149@f33g2000vbm.googlegroups.com> <1j57hiw.vmezw81qexbi6N%csampson@inetworld.net> <1bg7e0snmumug.m6mwq8uap1a6.dlg@40tude.net> <1j59bht.1g5hayoavhvvbN%csampson@inetworld.net> Date: Sun, 30 Aug 2009 22:43:07 +0200 Message-ID: <1xf9vizanpqch$.z91nhg4t9f89$.dlg@40tude.net> NNTP-Posting-Date: 30 Aug 2009 22:43:02 CEST NNTP-Posting-Host: 69dce4cf.newsspool2.arcor-online.net X-Trace: DXC=1iRQ[?Nb`[\YQ5E:l On Sun, 30 Aug 2009 11:34:00 -0700, Charles H. Sampson wrote: > Dmitry A. Kazakov wrote: > >> On Sat, 29 Aug 2009 10:47:17 -0700, I wrote: >> >>> This is not just theoretical musing. I currently work in the world >>> of compasses, so a range of the form [0.0 .. 360.0) is quite natural. >>> (That notation is neither mathematical nor Ada. I hope its meaning is >>> clear.) >> >> That is not range, the type would be not of real numbers. For example: >> >> 340.0 + 25.0 = 5.0 >> > Right, but that's not unusual. Of the predefined types of Ada, > only modular and enumeration types are closed under their predefined > operations. Float is also closed when the underlying machine type is IEEE. > What I want is a way to express the set of real numbers (in the Ada > sense) that an object of the type can legally hold. We already write > the code to prevent a stored value of 360.0. What I want is a > constraint error just in case we foul up. These are two different issues: 1. Ranges as first-class objects with operations on them. This includes intervals and interval operations. 2. Special kinds of arithmetic saturated, wrapped etc. > To be frank, I had forgotten that we can achieve the effect by > using Pred or some other attributes, even though I've done that in > another context. Actually T'Pred and T'Succ are poor implementations because they are machine-dependent and not directly (or clearly) derived from "digits" and "delta". > But my question essentially was, why weren't we given > a notation to do it directly and easily? Because it is too complex to do. Here I mean a built-in language feature in a patchwork of chaotic changes. Complexity is also in driving attention of ARG members to this concrete patch from a rapidly growing pile... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de