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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable 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 14:46:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!freenix!enst.fr!not-for-mail From: "Robert C. Leif" Newsgroups: comp.lang.ada Subject: RE: Saturated Math Date: Wed, 28 May 2003 14:45:34 -0700 Organization: ENST, France Message-ID: NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: avanie.enst.fr 1054158369 80175 137.194.161.2 (28 May 2003 21:46:09 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 28 May 2003 21:46:09 +0000 (UTC) To: "'Randy Brukardt'" , "Comp. Lang. Ada" Return-Path: X-Envelope-From: rleif@rleif.com X-Mailer: Microsoft Outlook, Build 11.0.4920 In-Reply-To: X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Thread-Index: AcMlXnR3iSMa92RrTTmzpwukSHcXpwAA24Fw X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:37948 Date: 2003-05-28T14:45:34-07:00 =20 I agree on the saturated math. However, is there a way for a private = integer type to work directly with Universal_Integers? It is a pain to type = convert the 2. My_Private_Integer_Y:=3D My_Private_Integer_X +2; -----Original Message----- From: Randy Brukardt [mailto:randy@rrsoftware.com]=20 Sent: Wednesday, May 28, 2003 11:56 AM To: comp.lang.ada@ada.eu.org >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.