dmd 1.046 and 2.031 releases
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jul 7 17:48:50 PDT 2009
Robert Jacques wrote:
>>> long g;
>>> g = e + f; => d = cast(long) e + cast(long) f;
>>
>> Works today.
>
> Wrong. I just tested this and what happens today is:
> g = cast(long)(e+f);
> And this is (I think) correct behavior according to the new rules and
> not a bug. In the new rules int is special, in this suggestion, it's not.
I think this is a good idea that would improve things. I think, however,
it would be troublesome to implement because expressions are typed
bottom-up. The need here is to "teleport" type information from the
assignment node to the addition node, which is downwards. And I'm not
sure how this would generalize to other operators beyond "=".
Andrei
More information about the Digitalmars-d-announce
mailing list