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.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7009ff26a584c028 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!news.cs.univ-paris8.fr!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Duncan Sands Newsgroups: comp.lang.ada Subject: Re: Dimensions and fixed point types Date: Fri, 11 Jun 2004 09:12:51 +0200 Organization: Cuivre, Argent, Or Message-ID: References: <40c6bf5c_1@baen1673807.greenlnk.net> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1086937981 1520 212.85.156.195 (11 Jun 2004 07:13:01 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Fri, 11 Jun 2004 07:13:01 +0000 (UTC) Cc: Martin Dowie To: comp.lang.ada@ada-france.org Return-Path: User-Agent: KMail/1.6.2 In-Reply-To: <40c6bf5c_1@baen1673807.greenlnk.net> Content-Disposition: inline X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:1382 Date: 2004-06-11T09:12:51+02:00 On Wednesday 09 June 2004 09:47, Martin Dowie wrote: > "Duncan Sands" wrote in message > news:mailman.77.1086765132.391.comp.lang.ada@ada-france.org... > > Fixed point types have a remarkable property: > > you can multiply any two of them to get a third. > > You can multiply apples and oranges and get > > bananas. This goes against type safety. > [snip] > > function "*" (Left : Apples; Right : Oranges) return Banana; > > pragma Import (Intrinsic, "*"); > > I think this is being addressed by the ARG in AI-364 > > http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00364.TXT?rev=1.6 > > Still a work item though... Hi Martin, thanks for the interesting reference. I don't like this approach at all: "improving" a wart by adding another little wart on top of it. It's damage control. The damage was done when the decision was taken to define multiplication and division automatically between any fixed point types (big mistake). I understand that the ARG wants to maintain backwards compatibility, but I think they are wrong. For example, suppose in Ada 200x this rule was thrown away, and replaced with the rule that you (the programmer) have to define multiplication explicitly, but can import it from intrinsic (see above). Then correct Ada 95 programs would no longer compile. However they could be made to compile and work the same via a purely mechanical operation: importing the multiplication operation in every unit where it is needed. It probably wouldn't be hard to write a tool that adds the right declarations automatically. So while backwards compatibility would not be retained (correct Ada 95 programs will no longer compile), the cost of upgrading would be quite small. This seems better to me: a little pain for a good gain. Ciao, Duncan.