From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7e60c1d99ae3ffa1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-13 03:02:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!b9ba5.pppool.DE!not-for-mail From: Dmitry A.Kazakov Newsgroups: comp.lang.ada Subject: Re: Announce: The Ultimate SI Units Cracker Date: Sat, 14 Sep 2002 00:09:35 +0200 Message-ID: References: <3D809F51.299A6634@despammed.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: b9ba5.pppool.de (213.7.155.165) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1031911341 697499 213.7.155.165 (16 [77047]) User-Agent: KNode/0.4 Xref: archiver1.google.com comp.lang.ada:28915 Date: 2002-09-14T00:09:35+02:00 List-Id: 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