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: Fri, 10 Aug 2018 16:50:50 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <9381f30a-a957-4477-b037-b2d60041e83e@googlegroups.com> <60ddd5ae-57e1-45e8-929c-302fabaa24ef@googlegroups.com> <96424a63-d811-4ade-88db-258f3febe60a@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: 7bit 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 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:54126 Date: 2018-08-10T16:50:50+02:00 List-Id: On 2018-08-10 15:59, Dan'l Miller wrote: > 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. In any Ada. Either way, classes of dimensioned object built as subtypes with the unit being a constraint or as related types with the unit being the type tag, most designs will use subtype- or class-wide objects. We need a type system capable of static checks when constraints or tags are statically known, a way to convert "Unit_Error may be raised" into hard type error. Then we will have both static checks and zero run-time overhead in static cases and fallback to dynamic checks in class-wide cases. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de