comp.lang.ada
 help / color / mirror / Atom feed
From: Duncan Sands <baldrick@free.fr>
To: comp.lang.ada@ada-france.org
Cc: Martin Dowie <martin.dowie@baesystems.com>
Subject: Re: Dimensions and fixed point types
Date: Fri, 11 Jun 2004 09:12:51 +0200
Date: 2004-06-11T09:12:51+02:00	[thread overview]
Message-ID: <mailman.90.1086937980.391.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <40c6bf5c_1@baen1673807.greenlnk.net>

On Wednesday 09 June 2004 09:47, Martin Dowie wrote:
> "Duncan Sands" <baldrick@free.fr> wrote in message
> news:mailman.77.1086765132.391.comp.lang.ada@ada-france.org...
> > Fixed point types have a remarkable property:
> > you can multiply any two of them to get a third.
> > You can multiply apples and oranges and get
> > bananas.  This goes against type safety.
> [snip]
> > function "*" (Left : Apples; Right : Oranges) return Banana;
> > pragma Import (Intrinsic, "*");
> 
> I think this is being addressed by the ARG in AI-364
> 
> http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00364.TXT?rev=1.6
> 
> Still a work item though...

Hi Martin, thanks for the interesting reference.  I don't like this approach
at all: "improving" a wart by adding another little wart on top of it.  It's
damage control.  The damage was done when the decision was taken
to define multiplication and division automatically between any fixed point
types (big mistake).  I understand that the ARG wants to maintain backwards
compatibility, but I think they are wrong.  For example, suppose in Ada 200x
this rule was thrown away, and replaced with the rule that you (the programmer)
have to define multiplication explicitly, but can import it from intrinsic (see above).
Then correct Ada 95 programs would no longer compile.  However they could
be made to compile and work the same via a purely mechanical operation:
importing the multiplication operation in every unit where it is needed.  It
probably wouldn't be hard to write a tool that adds the right declarations automatically.
So while backwards compatibility would not be retained (correct Ada 95 programs
will no longer compile), the cost of upgrading would be quite small.  This seems
better to me: a little pain for a good gain.

Ciao,

Duncan.



  parent reply	other threads:[~2004-06-11  7:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09  7:11 Dimensions and fixed point types Duncan Sands
2004-06-09  7:47 ` Martin Dowie
2004-06-09 17:04   ` Robert I. Eachus
2004-06-11  7:16     ` Duncan Sands
2004-06-11  7:12   ` Duncan Sands [this message]
2004-06-11  7:26 ` Hyman Rosen
2004-06-11  7:46   ` Duncan Sands
2004-06-11 17:47     ` Hyman Rosen
2004-06-11 19:10       ` Duncan Sands
2004-06-12  3:40         ` Robert I. Eachus
replies disabled

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