3 ms·
> Take this code: > [...] > It turns out that: > [...] > but you've not actually said that the return value is intended, or a side effect. Aren't the Ruby sema
by servilio 6y ago
> Take this code:
> [...]
> It turns out that:
> [...]
> but you've not actually said that the return value is intended, or a side effect.
Aren't the Ruby semantics clear about what happens in both of these cases (return values of methods and assignments) and hence it was the coder's choice to leave that as the return value?
- wlll 6y agoWether the programmer chose to do something is a large part of the issue here. An explicit return says "I chose to do this". An implicit return in these examples says "There may or may not have been a choice made" and that's the problem. If you rely on the assumption that a choice was made, you add risk.