From: Dmitry A.Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Announce: The Ultimate SI Units Cracker
Date: Sat, 14 Sep 2002 00:09:35 +0200
Date: 2002-09-14T00:09:35+02:00 [thread overview]
Message-ID: <alsd3c$l94r$1@ID-77047.news.dfncis.de> (raw)
In-Reply-To: 3D809F51.299A6634@despammed.com
Wes Groleau wrote:
> What I'm getting at is the ability to define a private type
> so that it has all the attributes and operations of a numeric
> type and can be use as a generic parameter to a numeric package.
IMO this is just a part of a far more general problem. The notion of
subtype in Ada presumes a shared representation. This is inherently flawed,
when separation of interface and implementation is considered. The rest is
only the consequences.
What is actually needed is an ability to define subtypes having different
representation. Then one could define dimensioned values as a subtype of
float. With the consequence, enforced by the compiler, that 'First,
'Adjacent etc have to be overridden.
-------------------
Then any discriminant-based solution faces the following problems:
1. There is no way to force the compiler to remove statically known
discriminants and calculate expressions on them at compile-time.
2. When shifted units (like Celsius degree) are considered, then the value
of the shift should be also a discriminant. But unfortunately Ada does not
allow floating-point ones. I made it a component, which is nasty, because
there is no way to have constrained subtypes of same shift [they form a
group].
-------------------
When it comes to scales [I considered such an option in my implementation],
then there is a problem that if a scale is attached to a dimensioned value
as an access discriminant, then the type has to be limited. Otherwise,
again there is no way to have subtypes constrained by same scale
--
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de
next prev parent reply other threads:[~2002-09-13 22:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-12 8:11 Announce: The Ultimate SI Units Cracker Grein, Christoph
2002-09-12 10:14 ` Preben Randhol
2002-09-12 10:50 ` Jeffrey Creem
2002-09-12 14:06 ` Wes Groleau
2002-09-12 17:06 ` Randy Brukardt
2002-09-13 15:20 ` Wes Groleau
2002-09-13 20:54 ` Randy Brukardt
2002-09-13 22:09 ` Dmitry A.Kazakov [this message]
2002-09-13 15:26 ` Wes Groleau
2002-09-15 6:21 ` Dmitry A.Kazakov
2002-09-15 0:24 ` Mark Biggar
2002-09-16 1:35 ` Dmitry A.Kazakov
-- strict thread matches above, loose matches on Subject: below --
2002-09-12 11:51 Grein, Christoph
2002-09-12 11:59 Grein, Christoph
2002-09-13 4:53 Grein, Christoph
2002-09-13 14:34 ` Ira Baxter
2002-09-13 20:50 ` Stephen Leake
2002-09-16 10:22 ` Fraser Wilson
2002-09-13 15:41 ` Wes Groleau
2002-09-13 5:34 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