Open russellquinn opened 1 year ago
I have an Ink function of the form:
=== function can_do_something() ~ return some_var == 0 && some_expensive_to_run_external_function() == true
some_expensive_to_run_external_function gets called every time, even when some_var == 0
some_expensive_to_run_external_function
some_var == 0
Ideally, for performance, Ink would follow other languages where typical behavior is:
&& guarantees left-to-right evaluation: the second operand is not evaluated if the first operand is false.
Agreed, this would be better. For now, you can optimise by nesting: { conditionA: { expensive_conditionB: stuff } } and help the ink along that way
Right, that would force the desired behviour. Thanks!
I have an Ink function of the form:
some_expensive_to_run_external_function
gets called every time, even whensome_var == 0
Ideally, for performance, Ink would follow other languages where typical behavior is: