comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Fixed point constants issue
Date: Tue, 14 Sep 2010 08:54:20 +0200
Date: 2010-09-14T08:54:20+02:00	[thread overview]
Message-ID: <i6n66u$3rg$1@news.eternal-september.org> (raw)
In-Reply-To: <op.vizozumhd20q5n@jellix.jlfencey.com>

Le 13/09/2010 23:08, Vinzent Hoefler a écrit :
>>> And, obviously it does this that when evaluating
>>>
>>>    TEN_FEET_4 : constant Altitude := Altitude (HEIGHT * FEET_PER_METER);
>>
>> Well, it does not, because here another type is involved.
> 
> Yes. So, the expression HEIGHT * FEET_PER_METER in the one case is
> evaluated by using the result type's multiplication operator and if the
> conversion is present, it is not, giving the more precise result.
> 
> That's still a bit crazy, IMHO.
> 
Every language with overloading has to decide whether resolution goes
from the outside to the inside, or the other way round. In the case of
Ada, it is the "enclosing context" that determines the type of what's in
it. If the enclosing context is a type conversion, it tells nothing
about the expected type of its argument, hence the fall back to
universal types. If the enclosing context is typed, it determines the
type of the "*" operator.
-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



  reply	other threads:[~2010-09-14  6:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-13 17:27 Fixed point constants issue Vinzent Hoefler
2010-09-13 18:04 ` Dmitry A. Kazakov
2010-09-13 18:25   ` Vinzent Hoefler
2010-09-13 19:05     ` Niklas Holsti
2010-09-13 20:35       ` Vinzent Hoefler
2010-09-13 20:35       ` Jeffrey Carter
2010-09-13 21:06         ` Vinzent Hoefler
2010-09-14  5:39         ` Niklas Holsti
2010-09-24 14:43         ` Markus Schöpflin
2010-09-24 20:05           ` Vinzent Hoefler
2010-09-24 21:38           ` Jeffrey Carter
2010-09-24 22:42             ` Vinzent Hoefler
2010-09-25  0:16               ` Jeffrey Carter
2010-09-27 10:33                 ` Markus Schöpflin
2010-09-27 18:57                   ` Jeffrey Carter
2010-09-28  8:16                     ` Markus Schöpflin
2010-09-28 17:28                       ` Jeffrey Carter
2010-10-05  6:27                         ` Randy Brukardt
2010-10-05 18:40                           ` Jeffrey Carter
2010-09-27 17:58             ` Adam Beneschan
2010-09-13 20:32     ` Dmitry A. Kazakov
2010-09-13 21:08       ` Vinzent Hoefler
2010-09-14  6:54         ` J-P. Rosen [this message]
2010-09-14 18:28           ` Vinzent Hoefler
2010-09-14  7:47         ` Dmitry A. Kazakov
2010-09-14 17:42           ` Vinzent Hoefler
2010-09-15  8:35             ` Dmitry A. Kazakov
2010-09-15 17:24               ` Vinzent Hoefler
2010-09-15 20:11                 ` Dmitry A. Kazakov
2010-09-14 19:44   ` Keith Thompson
replies disabled

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