Michael Daly skrev:
Rolf Lampa wrote:
this short circuit is very powerful for optimizing code execution.
It's also essential to allow common programming approaches such as:
if( A exists and A isblort() ) {...}
Yes. But is operator absent expressions (user defined operators like "A isblort") possible in PHP? (It's not supported in Delphi, that's why I didn't come to think of it).
Even short circuit behavior should allow user defined operators (I think it's supported in C#), given that the interpreter can handle , it only doesn't care
Complete boolean evaluation would fail in this case if A doesn't exist and would force two if statements.
Oh, this is the weaknesses with non "Strong typed" languages. However, why not interpret undefined expressions as "false"?
So many languages permit short-circuit evaluation that I'm surprised to find out that Delphi allows the opposite as an option.
Possibly for backward compatibility reasons (I don't know for sure though). I would never use "complete boolean evaluation" myself though, never.
I would never have expected Parserfunctions to not short-circuit.
It's very frustrating although I think there's a reason for this in the first place (MW actually being a "template engine", in which you would NOT expect to evaluate "active logic"). So I guess we shouldn't be too surprised, only frustrated... =)
Regards,
// Rolf Lampa