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: a07f3367d7,421379614df5a9cd X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!guardian.oit.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Range excluding 0.0 Date: Sat, 29 Aug 2009 15:28:25 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <6f1ce89e-7889-4d58-b0f8-1945727f5149@f33g2000vbm.googlegroups.com> <1j57hiw.vmezw81qexbi6N%csampson@inetworld.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1251574106 21267 192.74.137.71 (29 Aug 2009 19:28:26 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 29 Aug 2009 19:28:26 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:2UCRfq1RIS3dqWHODgrObDV0mRQ= Xref: g2news2.google.com comp.lang.ada:8052 Date: 2009-08-29T15:28:25-04:00 List-Id: csampson@inetworld.net (Charles H. Sampson) writes: > vlc wrote: >> >> I would like to declare a subtype of Float which ranges from 0.0 >> (excluded) to Float'Last. Is there a way to exclude the 0.0 from the >> range? > > You've already got the answer you need, but your question brings up > another that I've recently been puzzled about. Why doesn't Ada allow > all four flavors of ranges commonly used by mathematicians (and others): > individually including or excluding the endpoints? For that matter, why doesn't Ada allow arbitrary subsets? For example, "an integer in the range -1_000_000 to 1_000_000, except 0 is not allowed". Or, "an integer for which Is_Good returns True". ARG is thinking about adding type invariants and/or user-defined constraints, which could express such things. >...I've been around Ada > since close to the beginning and I don't recall that this was ever > discussed. At the same time, I have this vague memory that one of the > candidate languages might have had it, but I can't remember which one it > might have been. > > 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.) It's certainly not Ada, but why do you say it's not mathematical? I find it ugly, but I've certainly seen in maths textbooks. Ignoring the ugly syntax, the concept seems quite useful. - Bob