Java type annotations, multi-precision
bearophile
bearophileHUGS at lycos.com
Sun Feb 9 12:41:57 PST 2014
Walter Bright:
> Much like how ROR and ROL is efficiently handled in compilers
> by having the compiler recognize the equivalent expression, I
> think the best way to handle these issues is by having the
> compiler recognize the multi-precision expressions, and rewrite
> it internally into the optimal asm.
See:
https://d.puremagic.com/issues/show_bug.cgi?id=6829
My opinions:
- It's a fragile pattern recognition. In D.learn and elsewhere I
have seen people write the rot/rol in a way that DMD is not able
to recognize.
- It's not portable, because there is no guarantee that other
present or future compilers will perform that optimization. See
that issue 6829 thread for problems with LLVM.
- Generally it's nice to have a language that offers higher level
operations to the programmer, making coding simpler. But in this
case calling a function as rol/ror is very easy for the
programmer, it is not a burden at all. Replacing it with a
pattern to be written carefully is not a gain for the programmer.
And it helps the person that later reads the code at a bit higher
level (and currently Phobos doesn't have such ror/rol functions,
so they need to be written in user code).
Here I have suggested something different:
https://d.puremagic.com/issues/show_bug.cgi?id=9850
Bye,
bearophile
More information about the Digitalmars-d
mailing list