Expressions in PKSMacroC such as (a == 'x' && b == 'y') will always evaluate each sub-expression. This is in particular impractical when one tries to test an assumption in the 1st sub-expression necessary to evaluate the second expression such as in the following example:
if (size(array) > 10 && array[10] == 'x')...
Executing this code in PKSMacroC will cause a run-time error for arrays of size less then 10. To avoid the run-time error one must rearrange the expression to:
if (size(array) > 10) {
if (array[10] == 'x')...
To make implementing PKSMacroC code easier and to have PKSMacroC be more compatible to C- / Java-like languages we should support short-circuit evaluation aka McCarthy evaluation.
Expressions in PKSMacroC such as
(a == 'x' && b == 'y')
will always evaluate each sub-expression. This is in particular impractical when one tries to test an assumption in the 1st sub-expression necessary to evaluate the second expression such as in the following example:Executing this code in PKSMacroC will cause a run-time error for arrays of size less then 10. To avoid the run-time error one must rearrange the expression to:
To make implementing PKSMacroC code easier and to have PKSMacroC be more compatible to C- / Java-like languages we should support short-circuit evaluation aka McCarthy evaluation.