comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@crs4.it>
Subject: Re: Macks - adding unit constants?
Date: Thu, 06 Nov 2003 00:38:49 +0100
Date: 2003-11-06T08:59:15+00:00	[thread overview]
Message-ID: <3FA98A09.5040009@crs4.it> (raw)
In-Reply-To: <mailman.260.1067861497.25614.comp.lang.ada@ada-france.org>

Christoph Grein wrote:

> Why not:
> 
>    Dist: constant Meter := +0.000_86;

Because that converts a dimensionless number to a dimensioned number, 
and you can't do that (in physics).

> Or use Dmitry Kazakov's or my method:
> 
>   Dist: constant SI := 0.000_86 * Meter;
> or
>   Dist: constant SI := 0.86 * Milli * Meter;

This is in some ways more to my taste.  Here there are no conversions of 
dimensionless numbers to dimensioned numbers.  But I prefer the 
compile-time checking I get with Macks to the run-time checking implied 
in the above examples.

Jacob
-- 
"[...] *transfer* a bit of salary from the person who writes
  a bug to the person that finds a bug..." -- Keith Ray




  reply	other threads:[~2003-11-05 23:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-03 11:57 Macks - adding unit constants? christoph.grein
2003-11-05 23:38 ` Jacob Sparre Andersen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-11-06  9:58 christoph.grein
2003-10-20 11:08 christoph.grein
2003-10-09  7:57 Jacob Sparre Andersen
2003-10-14 16:01 ` Stephen Leake
2003-10-17 20:23   ` Jacob Sparre Andersen
2003-10-20 14:48     ` Preben Randhol
2003-11-03 11:45       ` Jacob Sparre Andersen
2003-11-03 14:24         ` Preben Randhol
2003-10-20 19:06     ` Stephen Leake
2003-11-03 11:45       ` Jacob Sparre Andersen
replies disabled

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