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-28 11:55:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!news.litech.org!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Saturated Math Date: Wed, 28 May 2003 13:56:17 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3ECFF541.1010705@attbi.com> <3ED0B820.5050603@noplace.com> <3ED2096F.3020800@noplace.com> <3ED353BE.40605@noplace.com> <3ED4A323.3000909@noplace.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3719.2500 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:37935 Date: 2003-05-28T13:56:17-05:00 List-Id: >Vinzent Hoefler wrote: >>How is it any less Ada-like than any other numeric type? >It introduces an ambiguity that clearly would need to be solved first. I agree with everything Vinzent said. Any type that would be added to Ada would have to have a clear mathematical underpinning. Otherwise, code would not be portable because compiler implementations would vary (in say the order of operations). An example is what this would mean in a code shared generic. In such a case, we'd have to pass in the bounds and include them in every math operation. That would be SLOW. 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. What would make sense in the standard would be some way to get numeric literals for private types, so that a user-defined type could work just like an integer type without any need for the compilers to get involved. Something like: package Saturation is type Saturated_Integer is private; for Saturated_Integer'Literal use Convert; function Convert (Value : in Root_Integer) return Saturated_Integer; function "+" (Left, Right : Saturated_Integer) return Saturated_Integer; -- etc. end Saturation; The idea being that when a literal occurs, the compiler wraps it into a call to Convert. You can sort of do this with unary "+", but it's annoying to always have to write "+" (and you also don't have a named "Root_Integer" type to use, so you have to use some other Integer type to get the proper range). There hasn't been much interest in this idea (or the related redefinition of array indexing), so don't hold your breath waiting for it. Randy.