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!water!watmath!clyde!bellcore!rutgers!gatech!bloom-beacon!tut.cis.ohio-state.edu!mailrus!uwmcsd1!bbn!inmet!ishmael!inmet!authorplaceholder From: wayne@inmet.UUCP Newsgroups: comp.lang.ada Subject: Re: Operator Overloading Resolution Message-ID: <124000015@inmet> Date: 8 Aug 88 14:20:00 GMT References: <30740@clyde.ATT.COM> Nf-ID: #R:clyde.ATT.COM:-3074000:inmet:124000015:000:1311 Nf-From: inmet.UUCP!wayne Aug 8 10:20:00 1988 List-Id: > /* Written 1:59 pm Aug 4, 1988 by rds@moss.ATT.COM in inmet:comp.lang.ada */ > /* ---------- "Operator Overloading Resolution" ---------- */ > The following code segment was compiled using Telesoft 3.15. ... > The expression -15 is evaluated to be of type INT_SCALAR. > Shouldn't this be an ERROR? No. DEC-Ada is correct, Telesoft is in error. The expression "15" is of course of type UNIVERSAL_INTEGER. According to LRM 4.10 and LRM 4.16:15 the subexpression "-15" is therefore also of universal integer, regardless of a function definition. It is then implicitly converted to INTEGER (LRM 4.6:15) when evaluating the rest of the expression because "left" is defined to be of INTEGER and a "<" is available with two INTEGER parameters which returns BOOLEAN. It can be assumed that if it possible for a subexpression to be of type universal expression, it will be of type universal expression. If you wish to use your definition of the negation operator, you must qualifiy the 15 to be of type INT_SCALAR , such as in result := left < - INT_SCALAR'(15); then it will be ambiguous, because there is no "<" defined to take both an INTEGER and an INT_SCALAR. Don't forget to initialize "left" or you may get an exception at run_time. Wayne Wylupski Intermetrics, Inc. Cambridge, MA