comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Trivial question: how to avoid confusing sec, min, hour and day in a program?
Date: Wed, 8 Sep 2021 15:00:44 -0700 (PDT)	[thread overview]
Message-ID: <703427c2-6ecc-4142-9adb-f12d0f9708e0n@googlegroups.com> (raw)
In-Reply-To: <nnd$6a29fdb2$054d11c6@d5a763e0a23fc394>

On Monday, September 6, 2021 at 1:22:03 AM UTC-6, ldries46 wrote:
> It would be a good idea if a package was developed that can solve all 
> these problems for instance by doing the calculations in one of the 
> possible dimensioning systems automagically presenting the results in 
> the dimension you choose.
There's this package[-set] -- http://archive.adaic.com/tools/CKWG/Dimension/SI.html
which is really pretty nice, and addresses the concern.

> I have already been thinking how but the problem are mostly in the  strings
Strings are terrible, avoid thinking in strings; be about the data first and foremost.
Strings should, inasmuch as possible, be used only in your UI; e.g. given a MVC structure only the VIEW should deal with Strings.

> I think that the potential of Ada of being independent of an operating 
> system can be extended that way to independent of the dimensioning system.
Possibly, the problem is addressed interestingly in VHDL via "physical units" where you can define a type and then use units with a conversion factor.
Example:

Type Avoirdupois_Weight is range 0 to 1E9 units
   Grain;
   Dram  =    27.34375 Grain;
   Ounce =    16.0 Dram;
   Pound =    16.0 Ounce;
   Ton   = 2_000.0 Pound
end units Avoirdupois_Weight;

  parent reply	other threads:[~2021-09-08 22:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-05  6:56 Trivial question: how to avoid confusing sec, min, hour and day in a program? reinert
2021-09-05  7:27 ` Dmitry A. Kazakov
2021-09-05 12:42   ` Niklas Holsti
2021-09-06  7:20   ` ldries46
2021-09-06  9:47     ` Dmitry A. Kazakov
2021-09-06 13:06       ` ldries46
2021-09-06 13:43         ` J-P. Rosen
2021-09-06 14:13           ` ldries46
2021-09-06 15:10             ` Dennis Lee Bieber
2021-09-06 15:55       ` AdaMagica
2021-09-08 22:00     ` Shark8 [this message]
2021-10-24  6:52   ` reinert
2021-10-24  7:24     ` J-P. Rosen
2021-10-24 10:39       ` Jeffrey R.Carter
2021-10-24 10:08     ` G.B.
2021-10-24 10:48     ` Simon Wright
2021-10-24 12:09     ` Björn Lundin
replies disabled

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