From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: SI Units Checked and Unchecked
Date: Fri, 10 Aug 2018 06:59:40 -0700 (PDT)
Date: 2018-08-10T06:59:40-07:00 [thread overview]
Message-ID: <96424a63-d811-4ade-88db-258f3febe60a@googlegroups.com> (raw)
In-Reply-To: <pkjcao$srd$1@gioia.aioe.org>
On Friday, August 10, 2018 at 1:45:47 AM UTC-5, Dmitry A. Kazakov wrote:
> On 2018-08-10 00:12, Dan'l Miller wrote:
>
> > Actually, I am talking about compile-time checks within Ada source code for a gauge as would be utilized on the GUI control screen of a chemical plant or a nuclear reactor, not some toy string-processing app that is the analogue of GNU Units.
>
> As I explained this design is technically not viable.
in today's Ada.
> Even taking an
> insanely huge overhead of making all components generic with measurement
> unit as a formal parameter, that would be less safe than a design based
> on constraints. With generics you can only pass same actual parameter or
> use a generic instance as a parameter, you cannot constraint generic
> instances in a way the algebra of measurement units works, e.g. length
> divided to time gives speed. So you will end up with generic instances
> for each particular unit but no mechanism to combine instances (of
> different generic types) in a unit-safe way. It will be in effect
> *untyped*. (Which is does not really matter since internal mechanisms
> like queuing of events, callbacks etc cannot be made generic anyway.)
>
> Compile-time unit checks can only be used in some numeric problems, for
> instance in the control loop. Everywhere else checks are run-time, which
> in case of widgets does not mean any real safety loss because
> practically all these checks are done upon initialization. When you
> create a gauge you connect a signal from a slider widget to it. Doing so
> the units of the gauge and of the slider's signal get checked. That
> happens once before the system starts. If you use a GUI design tool then
> this check could be performed even earlier before deployment. Chances of
> getting a run-time check fail are zero.
>
> >> The scalars are not unitless. The unit is a discriminant:
> >>
> >> http://www.dmitry-kazakov.de/ada/units.htm
> >
> > It looks like a string-processing library to support a toy units converter app,
>
> No string processing involved. It is same as saying that Integer is
> string processing because there exists Integer'Image.
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2018-08-10 13:59 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-09 12:44 SI Units Checked and Unchecked AdaMagica
2018-08-09 13:47 ` Dan'l Miller
2018-08-09 14:07 ` Dmitry A. Kazakov
2018-08-09 15:03 ` Dan'l Miller
2018-08-09 15:51 ` Dmitry A. Kazakov
2018-08-09 17:32 ` Dan'l Miller
2018-08-09 19:42 ` Dmitry A. Kazakov
2018-08-09 22:12 ` Dan'l Miller
2018-08-10 6:45 ` Dmitry A. Kazakov
2018-08-10 13:59 ` Dan'l Miller [this message]
2018-08-10 14:50 ` Dmitry A. Kazakov
2018-08-10 17:04 ` Dan'l Miller
2018-08-10 17:34 ` Dmitry A. Kazakov
2018-08-11 4:42 ` Paul Rubin
2018-08-11 5:46 ` Dmitry A. Kazakov
2018-08-11 19:57 ` Paul Rubin
2018-08-11 21:01 ` Dmitry A. Kazakov
2018-08-09 18:47 ` Paul Rubin
2018-08-09 19:13 ` Dan'l Miller
2018-08-09 14:31 ` AdaMagica
2018-08-09 15:19 ` Dan'l Miller
2018-08-09 16:07 ` Jeffrey R. Carter
2018-08-09 17:41 ` AdaMagica
2018-08-09 20:34 ` Jeffrey R. Carter
2018-08-10 9:13 ` AdaMagica
2018-08-10 20:20 ` Jeffrey R. Carter
2018-08-13 8:57 ` AdaMagica
2018-08-20 17:55 ` AdaMagica
2019-09-04 14:20 ` Shark8
2019-09-04 17:11 ` AdaMagica
2019-09-06 21:01 ` Shark8
2020-08-13 12:24 ` SI Units Checked and Unchecked - Completela overhauled version AdaMagica
-- strict thread matches above, loose matches on Subject: below --
2003-02-05 7:03 SI Units Checked and Unchecked Grein, Christoph
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox