Daniel Barrett skrev:
In a parserfunctions statement like this:
{{#if: {{#some-condition:}} | {{#some-big-computation:}} }}
if #some-condition is false, which of the following should happen?
- #some-big-computation gets fully evaluated, but results are not
displayed 2. #some-big-computation is not evaluated at all
Looks like choice #1 is happening in MW 1.12.0, which is bad if #some-big-computation has side-effects or is very expensive. Is this correct behavior?
It's absolutely crucial to short circuit boolen logic at first false result - in cases logically equivalent to AND operations.
Your example contains just such a case, the is, your 1:st expression should behave equivalent to
{{ if {{#some-condition1}} and <--- break here if "false"! {{#some-condition2}} and {{#some-conditionN}} then // do this (else nothing) }}
In for example Delphi the behaviour for boolean expressions is optional. Default setting for "complete boolen evaluation" is = False, that is, the compiler will produce logic which short circuits at first false result. And this short circuit is very powerful for optimizing code execution.
Regards,
// Rolf Lampa