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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a5f77772dc1375a3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-23 09:48:18 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!cox.net!newspeer1-gui.server.ntli.net!ntli.net!newsfep1-win.server.ntli.net.POSTED!53ab2750!not-for-mail From: "martin.m.dowie" Newsgroups: comp.lang.ada References: <3CEB7124.4050604@blancolioni.org> <01HW.B91197820000C3D90E449050@netnews.netaxs.com> <338040f8.0205230757.2150b881@posting.google.com> Subject: Re: Safe Units Handling in Ada X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Thu, 23 May 2002 17:48:06 +0100 NNTP-Posting-Host: 62.252.153.136 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfep1-win.server.ntli.net 1022172495 62.252.153.136 (Thu, 23 May 2002 17:48:15 BST) NNTP-Posting-Date: Thu, 23 May 2002 17:48:15 BST Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:24591 Date: 2002-05-23T17:48:06+01:00 List-Id: "Dan Andreatta" wrote in message news:338040f8.0205230757.2150b881@posting.google.com... > > The generated example.ads yields: > > ... > > function "*" > > (Left : Kilogram; > > Right : Kilogram) -- This is good, we want it abstract. > > return Kilogram > > is abstract; > > > > This also should return kg**2. Can you set this up as another rule? My own attempt at a Unit Generator package was allowed users to define: a) which of the SI base units they wanted b) which of the SI derived units they wanted c) to define alias (ie subtypes, e.g. "subtype Area is Metre_Squared;") of any unit d) to define a range of powers This lead to a package such as: generic type A_Float is digits <>; package SI_Units is type Unitless is new A_Float; type Metre is new A_Float; type Metre_Squared is new A_Float; type Metre_Cubed is new A_Float; function "*" (L : Metre; R : Metre) return Metre_Squared; ... end SI_Units; The problem I found with this approach was one of line numbers when all units are requested for the range **-3 .. **+3. Some code browsers don't seem to like file >1200 lines long!