D and expression evaluation order.
Russell Lewis
webmaster at villagersonline.com
Thu Apr 26 13:49:26 PDT 2007
Walter Bright wrote:
> Bruno Medeiros wrote:
>> That's nice, but why not go all the way, and actually define an
>> evaluation order for such expressions.
>
> I want to do that eventually, but it isn't easy to do. (There are also
> issues with making it work with a C back end, where the C optimizer
> reorders things according to what is legal C.)
To me, this sounds like a slam-dunk argument for never defining an
evaluation order. Why prevent optimizers from doing all that they can
conceive of? IMHO, the only places where you want to define evaluation
order is when it makes the program clearer, and the examples given are
(again, my opinion) examples of bad coding style. If you want to do
something complex, then code the steps in different statements; then
it's totally clear what you're trying to do - to both the compiler *and*
the guy maintaining your code 10 years from now.
Russ
More information about the Digitalmars-d
mailing list