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,FREEMAIL_FROM autolearn=ham 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!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 09 Jun 2004 12:04:01 -0500 Date: Wed, 09 Jun 2004 13:04:01 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Dimensions and fixed point types References: <40c6bf5c_1@baen1673807.greenlnk.net> In-Reply-To: <40c6bf5c_1@baen1673807.greenlnk.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-VaX8rWV/o7zSHZ+qC7WfldJRS2oz3emfriOjIeB353qAWNQ78CM6pk4j4YbRlrk52IkX5dYl2pS8feT!BvItxbMwmeKleu5aWodT4Kyz3nwIZ3l6QUJ9r9VHNaCfjtKDlE0X3EutdZlcSw== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:1326 Date: 2004-06-09T13:04:01-04:00 List-Id: 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. I agree, and I objected to the original Ada95 rule that allowed the explict type conversion from universal fixed to be omitted. In addition to the problems created when you do want to explicitly define a multiply operation, it creates the serious problem Duncan refers to: >> Suppose I have several fixed point types, for >> example >> >> type Price is delta 0.01 digits ...; >> type Volume is delta 1.0 digits ...; >> type Value is delta 0.01 digits ...; P: Price; V: Volume; Val: Value; ... P := V * Val; -- the compiler won't object! > 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... What is being worked on is actually different problem, where you do want to declare your own multiplication or division operators, and find that they can't be called in infix notation. That having been said, the current version exactly fixes Duncan Sands problem. According to the new draft, if you declare a multiplication operation for Apples, all of the "special" Apple * fixed and fixed * Apple operations returning universal_fixed will be hidden where the user defined operators are visible. So to go back to Duncan's original complaint add: function "*"(Left: Price; Right: Volume) return Value; This will hide ALL the predefined operations that Duncan wants to get rid of, and any new ones that involve Price, Volume, or Value, so the line: P := V * Val; -- The compiler will complain that no visible "*" matches. Glad to be of service. ;-) -- Robert I. Eachus "The terrorists rejoice in the killing of the innocent, and have promised similar violence against Americans, against all free peoples, and against any Muslims who reject their ideology of murder. Their barbarism cannot be appeased, and their hatred cannot be satisfied. There's only one way to deal with terror: We must confront the enemy and stay on the offensive until these killers are defeated." -- George W. Bush