comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Range excluding 0.0
Date: Sun, 30 Aug 2009 22:43:07 +0200
Date: 2009-08-30T22:43:02+02:00	[thread overview]
Message-ID: <1xf9vizanpqch$.z91nhg4t9f89$.dlg@40tude.net> (raw)
In-Reply-To: 1j59bht.1g5hayoavhvvbN%csampson@inetworld.net

On Sun, 30 Aug 2009 11:34:00 -0700, Charles H. Sampson wrote:

> Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> 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



      reply	other threads:[~2009-08-30 20:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-29 12:50 Range excluding 0.0 vlc
2009-08-29 13:12 ` Dmitry A. Kazakov
2009-08-29 13:46 ` John B. Matthews
2009-08-29 17:10   ` vlc
2009-08-29 17:47 ` Charles H. Sampson
2009-08-29 19:28   ` Robert A Duff
2009-08-30 18:34     ` Charles H. Sampson
2009-08-29 20:51   ` John B. Matthews
2009-08-30  7:34     ` Dmitry A. Kazakov
     [not found]       ` <7_KdnXzM3cepeAfXnZ2dnUVZ_vidnZ2d@earthlink.com>
2009-08-31  7:37         ` Dmitry A. Kazakov
2009-08-31 13:58           ` John B. Matthews
2009-08-31 18:49             ` Dmitry A. Kazakov
2009-09-01 18:10               ` Keith Thompson
     [not found]             ` <iradnblskszGlgHXnZ2dnUVZ_oSdnZ2d@earthlink.com>
2009-09-01  0:36               ` John B. Matthews
2009-08-30  7:38   ` Dmitry A. Kazakov
2009-08-30 18:34     ` Charles H. Sampson
2009-08-30 20:43       ` Dmitry A. Kazakov [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox