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,CP1252 X-Google-Thread: 103376,dab1e23fc81e6b17 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-03 00:55:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail Message-ID: <3F03E17E.7030305@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: overriding "*", was Re: What's the ICFP Programming contest? References: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc53 1057218945 24.62.164.137 (Thu, 03 Jul 2003 07:55:45 GMT) NNTP-Posting-Date: Thu, 03 Jul 2003 07:55:45 GMT Organization: Comcast Online Date: Thu, 03 Jul 2003 07:55:45 GMT Xref: archiver1.google.com comp.lang.ada:40007 Date: 2003-07-03T07:55:45+00:00 List-Id: tmoran@acm.org wrote: > For the contest I needed to override normal fixed point multiply and > divide, so I declared > type Root_Numbers is delta ... > type Numbers is new Root_Numbers; > function "*"(Left, Right : Numbers) return Numbers; > A, B, C : Numbers; > and tried to use it in formulas like > C := Numbers(A * B); > But a compiler said the "*" was ambiguous between my function and Standard. > It seems to me I overrode, and thus hid, Standard."*", no? > p.s. I did manage to write a program that successfully drove the first 5 > out of 9 race tracks. It gets really lost though in the maze-like ones. > The "programming" contest really becomes an "algorithm" contest there. There are fixed-point multiplying operators that return universal-fixed. You can't override or hide them. What you can do is write: C := Numbers'(A * B); This requires the result to be of type Numbers. The magic is that in Ada 95, there can be an implict conversion on the assignment, but the qualified expression comes first. -- Robert I. Eachus �In an ally, considerations of house, clan, planet, race are insignificant beside two prime questions, which are: 1. Can he shoot? 2. Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and Steve Miller.