comp.lang.ada
 help / color / mirror / Atom feed
From: rracine@ajpo.sei.cmu.edu (Roger Racine)
Subject: Re: Implicit conversion?
Date: 17 Mar 89 18:11:45 GMT	[thread overview]
Message-ID: <474@ajpo.sei.cmu.edu> (raw)
In-Reply-To: 57900090@ada-uts

With respect to 

X := MAX_INT - MAX_INT;

Why would it be necessary to convert MAX_INT to anything?  There exists a
predefined "-" operation which takes two universal_integers and returns
universal_integer.  Then one is left with 

X := 0;

Implicit type conversion on the 0 works fine, and no errors occur.

On the other hand, if the implicit type conversion did take place, I think
the LRM is clear that CONSTRAINT_ERROR should occur (4.6 para 12).

4.6 para 15 states:
"An implicit conversion ... is applied if and only if the innermost complete
context (see 8.7) determines a unique ... target type for the implicit
conversion, and there is no legal interpretation of this context without
this conversion."

While the innermost complete context, which is the statement, does determine
a unique target type, I would maintain that there is a legal interpretation
without the conversion.  The subtraction can be seen as a universal
expression, which is then converted.

I do NOT see how one can consider the implicit conversion of MAX_INT to be
an "intermediate result" of a predefined operation.  I always took that
phrase to mean "once the operations started, if the expression has more
than one operation, NUMERIC_ERROR does not need to be raised even if one
of the operations gives a result which is outside the range of the base
type."  

Please help me understand why an implementation should be allowed to
raise ANY exception.

  reply	other threads:[~1989-03-17 18:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5678@sdcrdcf.sm.unisys.com>
1989-03-08 16:38 ` Implicit conversion? Robert Eachus
1989-03-13 22:31   ` Steven Holtsberg
1989-03-09 15:40 ` stt
1989-03-17 18:11   ` Roger Racine [this message]
1989-03-18  9:46     ` Steven Holtsberg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox