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,1dd28d5040ded1f8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-21 01:43:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!pec-10-119.tnt1.hh2.uunet.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Announce: Grace project site operational Date: Tue, 21 May 2002 10:45:17 +0200 Message-ID: References: <3CE15D0A.3050100@mail.com> <3ce21f37$1@pull.gecm.com> <3CE2AB7E.AD4A9956@san.rr.com> <3CE2B842.7060705@mail.com> <3CE2F4E3.DABF19D7@san.rr.com> NNTP-Posting-Host: pec-10-119.tnt1.hh2.uunet.de (149.225.10.119) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1021970590 26066583 149.225.10.119 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:24450 Date: 2002-05-21T10:45:17+02:00 List-Id: On 17 May 2002 17:03:39 +0200, Fraser Wilson wrote: >Unfortunately, there's a wee problem with magnitude changes; say I add >the following: > > function "*" (Left : Float; Right : Metres) return Metres; > >Then for M : Metres, M := 2.0 * M is ambiguous, because of Standard."*" > >What's more, Standard."*" has no meaning in this domain, but there's >no way (as far as I know) of getting rid of it. Override it with abstract. It is possible for non-tagged types. Here is how it is made in my implementation of units: with Interfaces; package Units is pragma Pure (Units); subtype UnitPower is Interfaces.Unsigned_32; type Unit is new UnitPower; function "**" (Left : Unit; Right : Integer) return Unit; function "*" (Left, Right : Unit) return Unit; function "/" (Left, Right : Unit) return Unit; function Sqrt (X : Unit) return Unit; pragma Inline ("**", "*", "/", Sqrt); function Image ( Value : Unit; Latin1 : Boolean := True ) return String; -- -- The following operations are disallowed. -- function "abs" ( Right : Unit) return Unit is abstract; function "and" (Left, Right : Unit) return Unit is abstract; function "mod" (Left, Right : Unit) return Unit is abstract; function "not" ( Right : Unit) return Unit is abstract; function "or" (Left, Right : Unit) return Unit is abstract; function "rem" (Left, Right : Unit) return Unit is abstract; function "xor" (Left, Right : Unit) return Unit is abstract; function "+" (Right : Unit) return Unit is abstract; function "-" (Right : Unit) return Unit is abstract; function "+" (Left, Right : Unit) return Unit is abstract; function "-" (Left, Right : Unit) return Unit is abstract; private PowerBits : constant := (UnitPower'Size - 1) / 7; Current : constant := 2**(PowerBits*0); Luminescence : constant := 2**(PowerBits*1); Temperature : constant := 2**(PowerBits*2); Mass : constant := 2**(PowerBits*3); Length : constant := 2**(PowerBits*4); Quantity : constant := 2**(PowerBits*5); Time : constant := 2**(PowerBits*6); Unitless : constant := 0; end Units; --- Regards, Dmitry Kazakov www.dmitry-kazakov.de