Re: Short-circuit warning
- Posted by Matt Lewis <matthewwalkerlewis at gmail?c?m> May 20, 2008
- 689 views
Jeremy Cowgar wrote: > > Is this warning really valid: > > Warning: ../bin/indent.ex:53 - call to matches() might be short-circuited > > Well, maybe valid, but useful? For instance, I specifically made the if > statement > to short-circuit, that's the way I want it. I program all the time counting > on short circuits and do not really feel as though I need a warning about it. > I thought short-circuits were a benefit? Yes, they are, but if the part that is being short circuited has side effects, you may not really want to short circuit. I think that was the real reason for the warning. And it's still valid. I think we probably should keep it, but we might be able to improve it by eliminating cases where we can prove that there are no side effects. I haven't studied that part of the code, so I'm not sure how feasible this is. Matt