comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: WG: SI Units - has Ada missed the boat?
Date: Mon, 9 Jul 2007 11:49:15 +0200
Date: 2007-07-09T11:45:56+02:00	[thread overview]
Message-ID: <9b9meiq7n6ha.y9tw152a6m2r$.dlg@40tude.net> (raw)
In-Reply-To: mailman.1.1183971374.3834.comp.lang.ada@ada-france.org

On Mon, 09 Jul 2007 10:55:53 +0200, Grein, Christoph (Fa. ESG) wrote:

>> One of my pet hopes for Ada2005 was that it would include some method
>> of automatically checking systems of units at compilation time or with
>> minimal run-time checking. Alas it was voted down due to time
> 
> I have to admit that I was the main perpetrator who killed that
> proposal.

Fortunately. Be praised for that!

>> Is anyone still working on an Ada solution to this?
> 
> I don't think so, if you mean a method to include in the Ada standard.

Yes, and if we'd put together more or less obvious requirements of how an
Ada(tm) solution should look like, we would easily see a need in some
language changes. My strong impression is that these changes should go
beyond sole units support. For example, it is quite obvious that the unit
constraint should be put on the object, be it a floating-point number or a
matrix of. We just don't have any universally working mechanism for that.
Same with dimensioned literals, which would imply a user-defined literals
support, etc.

In short, units is just a use case, it should not be viewed as a language
feature.

> But there are a lot of such methods distributed in some home pages, see
> Dmitry Kazakov, mine, ... (I guess there are plenty others)

The new version of my measurement units for Ada with GTK tree view cell
renderers and combo boxes for dimensioned values is coming soon.

> I don't know C++ and so I do not know how it deals mit rad, Newton
> Meters and Joule in
> 
> Work [Joule] = Torque [Newton*Meter] * Angle [rad]
> 
> Or sin x = x + x**3/3! + ... where x is in rad, sin x has dimension 1
> (not rad).
>
> Or Bq = 1/s, Hz = 1/s, but Bq /= Hz.

Such differences should be handled outside the unit system. It cannot know
the semantics of the values. So rad = 1 SI. Or else m (of height) /= m (of
distance on a highway)

But how C++ handles (I guess it does not)

   X := Vector (I);  -- Both X and Vector are dimensioned

   Y : Unit := Ask_User_For;

   Z : Magnitude := 5 dB; -- May I have logarithmic scales?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2007-07-09  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-09  8:55 WG: SI Units - has Ada missed the boat? Grein, Christoph (Fa. ESG)
2007-07-09  9:49 ` Dmitry A. Kazakov [this message]
2007-07-10  1:26 ` Hyman Rosen
2007-07-10  9:14   ` Martin
2007-07-10  9:22 ` Martin
2007-07-12  1:27 ` none
2007-07-12 10:39   ` Colin Paul Gloster
2007-07-13 22:20   ` Dr. Adrian Wrigley
replies disabled

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