Hacker News new | past | comments | ask | show | jobs | submit login

> 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?




Wether 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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: