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,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-30 01:44:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!ken-transit.news.telstra.net!news.telstra.net!news-server.bigpond.net.au!not-for-mail From: Dale Stanbrough Newsgroups: comp.lang.ada Subject: Re: Saturated Math References: <3ECFF541.1010705@attbi.com> <3ED0B820.5050603@noplace.com> <3ED2096F.3020800@noplace.com> <3ED353BE.40605@noplace.com> <3ED4A323.3000909@noplace.com> <3ED5E8DE.8070308@noplace.com> User-Agent: MT-NewsWatcher/3.3b1 (PPC Mac OS X) Message-ID: Date: Fri, 30 May 2003 08:42:36 GMT NNTP-Posting-Host: 144.132.47.50 X-Complaints-To: abuse@bigpond.net.au X-Trace: news-server.bigpond.net.au 1054284156 144.132.47.50 (Fri, 30 May 2003 18:42:36 EST) NNTP-Posting-Date: Fri, 30 May 2003 18:42:36 EST Organization: BigPond Internet Services (http://www.bigpond.net.au) Xref: archiver1.google.com comp.lang.ada:38052 Date: 2003-05-30T08:42:36+00:00 List-Id: Marin David Condic wrote: > Randy Brukardt wrote: > > > > But probably the best reason that something like this will not be added > > to Ada is that it doesn't add anything. There is nothing here that > > cannot be done with code you write yourself. Since there is no hardware > > support for these types, everything is a batch of code anyway; it might > > as well be done with an in-lined subprogram. I've just tried writing such a package (generic) and it doesn't seem that it would be altogether seemless for the end user. Given a declaration like this... generic type Number is range <>; package Saturate is function "+" (left, right : Number) return Number; function "-" (left, right : Number) return Number; function "*" (left, right : Number) return Number; function "/" (left, right : Number) return Number; function "**" (left, right : Number) return Number; ... a calling procedure would look like this... procedure main is type Number is new Integer range 1..5; package Saturated_Int is new Saturate (Number); use Saturated_Int; x : Number := 4; begin x := Saturated_Int."+" (x, 2); x := Saturated_Int."-" (x, 6); end; The function "+" in the following x := x + 2; is said to be ambiguous with Standard."+" (according to gnat). Am I missing something? Dale