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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b023521659e212ce,start X-Google-Attributes: gid103376,public From: William A Whitaker Subject: Units Checking is Ada - Solicitation of Comments on Standard Proposal Date: 1997/08/06 Message-ID: <33E80CA8.3DEC@erols.com>#1/1 X-Deja-AN: 262600091 Reply-To: whitaker@erols.com Organization: Erol's Internet Services X-Received-On: 6 Aug 1997 05:34:30 GMT Newsgroups: comp.lang.ada Date: 1997-08-06T00:00:00+00:00 List-Id: I am soliciting comments on a standards proposal for units Ada checking. Please send comments directly to me at - whitaker@erols.com There has long been discussion of using the properties of Ada for the checking of physical units in engineering/scientific applications, with little result. Most often it is sketched as an example in texts, but never brought to completion. A full system was standardized in 1993 as part of IEEE Std 1226.1, however the units checking portion did not receive much as there was a non-checking primary option. For the upgrade of IEEE Std 1226.1 (given the new number of P1446) changes have been made to make the system more user-friendly. Along with more intelligent compilers and some Ada 95 features, this has encouraged a stronger push for regular use of Ada units checking. The Ada community is invited to comment on and make suggestions about the proposal before it goes to ballot. There is a brief write-up in the form of a P1446 Issue, but the associated code has been modified to be stand-alone Ada for this exercise. Two trivial test programs are provided (Test_SI and Test_Other_Units). Please test with your examples. Issue: http://www.erols.com/whitaker/iss_418.htm Code: http://www.erols.com/whitaker/si_check.ada -- There is cuteness in the code such that GNAT earlier than 3.10 has a problem. A somewhat modified version is provided for earlier GNAT (but comments are solicited on the full version): http://www.erols.com/whitaker/si_gnat.ada General P1446 Page: http://www.erols.com/whitaker/p1446.htm The present proposal is as follows. There is a package SI which has the definition of Unit as a discriminant record. SI.Ops contains the operations ("*", "/", etc.) as well as the conversion from Real to the desired unit. In a new twist, the conversion functions are defaulted to 1.0, meaning that Meter(1.0) and Meter are equivalent. SI.Ops.Symbols contains the unit constants for the trick above. There are other supporting packages for Unit_Text_IO and Unit_Conversions to/from Other_Units ("English"). All this is based on IEEE Std 1226.1 (1983).