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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cc4f25d878383cc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-02 16:24:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!oleane.net!oleane!freenix!enst!enst.fr!not-for-mail From: "Robert C. Leif, Ph.D." Newsgroups: comp.lang.ada Subject: RE: Another Idea for Ada 20XX Date: Sun, 2 Dec 2001 16:21:23 -0800 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1007339045 15828 137.194.161.2 (3 Dec 2001 00:24:05 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 3 Dec 2001 00:24:05 +0000 (UTC) To: Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-Mimeole: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal In-Reply-To: <3C0A5054.E74A82E7@worldnet.att.net> Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:17320 Date: 2001-12-02T16:21:23-08:00 From: Bob Leif To: James Rogers et al. A package to do this, A Broad-Based Environment for Test (ABBET), was created by William A Whitaker, Ph.D. There is also a collection of packages by Dmitry A. Kazakov. I believe that it might be possible to have either the compiler optimize away the unit checking for objects where the units are constant and/or create a class of assertions that are only checked at compile time. Fresh ideas on this subject should have a high priority for Ada 200X. -----Original Message----- From: comp.lang.ada-admin@ada.eu.org [mailto:comp.lang.ada-admin@ada.eu.org]On Behalf Of James Rogers Sent: Sunday, December 02, 2001 8:01 AM To: comp.lang.ada@ada.eu.org Subject: Another Idea for Ada 20XX In scientific terms a measurement is done in terms of some unit. For instance, distance is in meters, microns, feet or furlongs. Speed is then calculated as a distance per unit time. Acceleration is the second derivative of speed. I would like to have this notion of measurement units and their relationships supported in a language. This would require the language to perform unit analysis while performing static or run-time calculations. Because of the added computational overhead, there must be a way to choose or reject unit analysis for defined types. Perhaps a new keyword for unit-analyzed types could be introduced, along the lines of the keyword "tagged" added to Ada 95. A unit- analyzed type would carry its own unit description tag to facilitate unit analysis. Any numeric type without such a tag would not be subject to unit analysis. Possible declarative syntax might be: type Meters is unit range (0.0..1.0E380); type Hours is unit range (0.0..9.99E30); type Speed is unit(Meters / Hours); The advantage for the software developer is in the usage: Vehicle_Speed : Speed; Track_Distance : Meters; Lap_Time : Hours; Speed := Track_Distance / Lap_Time; This approach would allow the appropriate mixing of data types, which is currently forbidden by Ada, in a meaningful and correct manner. I know this proposal places a heavy burden upon compiler writers. I also suspect it would be very useful for ensuring the correctness of programs, particularly in embedded systems. Note that a lot of the unit analysis could be performed statically. This would allow minimal performance penalty at run time. Jim Rogers Colorado Springs, Colorado USA