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-17 08:44:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!wn3feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail Message-ID: <3CE524EE.4BCAE7F3@attbi.com> From: Mark Biggar X-Mailer: Mozilla 4.79 [en]C-{C-UDP; EBM-SONY1} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Announce: Grace project site operational References: <4519e058.0205140718.3ddb1b2a@posting.google.com> <3CE15D0A.3050100@mail.com> <3ce21f37$1@pull.gecm.com> <3CE2AB7E.AD4A9956@san.rr.com> <3CE2B842.7060705@mail.com> <3CE2F4E3.DABF19D7@san.rr.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 12.235.88.57 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1021650271 12.235.88.57 (Fri, 17 May 2002 15:44:31 GMT) NNTP-Posting-Date: Fri, 17 May 2002 15:44:31 GMT Organization: AT&T Broadband Date: Fri, 17 May 2002 15:44:32 GMT Xref: archiver1.google.com comp.lang.ada:24280 Date: 2002-05-17T15:44:32+00:00 List-Id: 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. > > If I don't define a magnitude changing function, then M := 2.0 * M > works, but M := F * M doesn't (for F : Float). > > The way to fix all this would be to make the types private, and supply > conversion functions. I've always found that ugly though. No, your problem is not with Standard."*", it is with the implicit definition of 'function "*"(Left, Right: Metres) return Metres' that you get when you defined the type Metres. Ada 95 provides a way to turn off such implicit definitions like so: type Metres is new Float; -- kill unwanted ops function "*"(Left, Right: Metres) return Metres is abstract; function "/"(Left, Right: Meters) return Metres is abstract; -- define wanted ops function "*"(Left, Right: Metres) return Area; function "*"(Left: Float, Right: Metres) return Metres; -- ... -- Mark Biggar mark.a.biggar@attbi.com