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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!IBM.COM!NCOHEN From: NCOHEN@IBM.COM (Norman Cohen) Newsgroups: comp.lang.ada Subject: (none) Message-ID: <030889.085958.ncohen@ibm.com> Date: 8 Mar 89 13:59:58 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: Subject: Implicit conversion? Ref: INFO-ADA Digest Volume 89 Issue 72 (Wed, Mar 8, 1989) Item #4 (by Steven Holtsberg) In the example with SYSTEM; use SYSTEM; procedure example is x: tiny_integer; begin x:= MAX_INT - MAX_INT; end example; the two occurrences of the named number MAX_INT (which are "convertible universal operands" as defined in RM 4.6(15)) are each converted to type Tiny_Integer. The "-" operator thus denotes the subtraction operation for type Tiny_Integer. Steven Holtsberg may have read too much into the rule (from RM 4.6(15)), "An implicit conversion of a convertible universal operand is applied if and only if the innermost complete context (see 8.7) determines a unique (numeric) target type for the implicit conversion...." This determination can be indirect: The innermost complete context determines that the righthand side of the assignment must be of type Tiny_Integer; since the only visible "-" operator with a result of type Tiny_Integer is the "-" with operands of that type, the two operands must each be of type Tiny_Integer; thus the conversion takes place. In contrast, the complete context Integer_Is_Symmetric: Boolean := Min_Int = -Max_Int; does not determine a unique target type for a conversion. Furthermore, there is a "legal interpretation of this context without ... conversion" (RM 4.6(15) again), so no conversion takes place. The unary "-" with an operand and result of type universal_integer is applied to Max_Int, and the "=" operator with operands of type universal_integer and a result of type Boolean is then applied to Min_Int and the result of the negation. Norman Cohen