Evaluation order
Michiel Helvensteijn
m.helvensteijn.remove at gmail.com
Wed Feb 24 23:55:52 PST 2010
Walter Bright wrote:
>> This is because to me, any asymmetric choice of evaluation order would be
>> arbitrary and wrong. What's so special about left-to-right?
>
> Arbitrary, yes. Wrong? no - specifying it removes another source of
> potential user bugs. Left-to-right is natural because that's the way we
> read things.
I'm sure you are aware that entire cultures read things right-to-left.
Anyway, don't think I don't see your reasoning. I can argue your point:
* Even though both are equally well-defined behavioral contracts, many
people will understand a fixed sequential order better than
non-deterministic choice, so might cause more bugs in the latter case.
* D already contains English keywords and English libraries. It's already
dominantly western, so left-to-right won't be unexpected.
I just have this quest for a beautiful and elegant programming language. In
such a language, the order of side-effects should not matter in any
operation (not just function calls).
Operators that are commutative in math (and, or, +, *) should be commutative
in the programming language too, regardless of side-effects and
short-circuiting (which would still be possible, ask me how).
But I understand why D places more value on practicality than beauty and
elegance.
--
Michiel Helvensteijn
More information about the Digitalmars-d
mailing list