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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: SI Units Checked and Unchecked Date: Sat, 11 Aug 2018 12:57:33 -0700 Organization: A noiseless patient Spider Message-ID: <877ekw1xsi.fsf@nightsong.com> References: <9381f30a-a957-4477-b037-b2d60041e83e@googlegroups.com> <60ddd5ae-57e1-45e8-929c-302fabaa24ef@googlegroups.com> <96424a63-d811-4ade-88db-258f3febe60a@googlegroups.com> <99af08dd-39fb-4c1e-a247-eef9680a2abd@googlegroups.com> <87k1oxfr9v.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="f31cea886a7d49865f708e61376b3999"; logging-data="30231"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19N9nkYpZPvJ2HgdTBYqhfb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cancel-Lock: sha1:95uDye27XnHT2Y18vd84BAQKywA= sha1:7/K2jh8cUYjIKOjcSADdsoj9I/I= Xref: reader02.eternal-september.org comp.lang.ada:54144 Date: 2018-08-11T12:57:33-07:00 List-Id: "Dmitry A. Kazakov" writes: >>> No language change can make dynamic cases static. >> I think the idea is to allow constraints on generic instantiation >> precise enough to use them for unit checking. > Dynamic is not static. Well the idea is to check the constraints statically. Obviously in cases where values can be introduced at runtime, there must be a way to connect them up with units, through protected methods or whatever. Once they are in the system, the types track them. I don't understand why there is even a desire in a scientific-style program to track quantities in more than one dimensionally equivalent unit (e.g. liters vs gallons). Just convert everything to a uniform set of units (probably SI) when they come into the system, and then do all internal calculations with that unit set.