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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: SI Units Checked and Unchecked Date: Thu, 9 Aug 2018 16:07:21 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <9381f30a-a957-4477-b037-b2d60041e83e@googlegroups.com> NNTP-Posting-Host: IzvqdhUtDGKIMCldyDtZ+w.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:54106 Date: 2018-08-09T16:07:21+02:00 List-Id: On 2018-08-09 15:47, Dan'l Miller wrote: > Shouldn't the •entire• point of a units-of-measurement library (or feature of language) be compile-time errors, not run-time exceptions/errors. No, because in most cases the unit is unknown. Consider a widget library with instruments indicating dimensioned values, dimensioned calculator, serialization of dimensioned data etc. What is necessary but not sufficient is language support for handling statically known constraints using compile-time static operations and removing statically known discriminants from the representation. Note a direct analogy with classes for scalar types. Type tag is in essence just a discriminant. For some types we want static discriminants and other constraints removed. > I would be interested in a summary (or even better, an AI) that itemizes all the core-language obstacles in currently-standardized Ada to moving all the incompatible usages of units to be compile-time errors instead of raising exceptions. The Ada type system is not capable to handle dimensioned types. I posted a list of requirements for a dimensioned types support some years ago here. There are lots of language issues to resolve first before approaching dimensioned types. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de