3 ms·
> Relying on short circuiting to avoid side effects or improving performance meaningfully is pretty shaky. You've got it all backwards. Short-circuiting is not
by simplotek 4y ago
> Relying on short circuiting to avoid side effects or improving performance meaningfully is pretty shaky.
You've got it all backwards. Short-circuiting is not used to avoid side effects. Short-circuiting is used to avoid needless calls to any predicate, which can have and often do has side-effects, and if it doesn't have today it might have tomorrow.
If you don't call them when you don't have to, your code is in a better shape.
And let's not pretend that unconditionally macode with side effects when you don't have to is a good practice.