Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If callers typically know statically whether they want emoji or not (in other words, if the parameter would typically be a literal true or false at the call site), then the parameterless version is better. (Note that you can still factor out common code from the two functions into a separate private function if you like. So the parameterless version doesn’t necessarily imply code duplication.) If, on the other hand, callers tend to be parameterized themselves on whether to use emojis or not, then the parameterized version is better, because it avoids having to make a case distinction at the call site.


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

Search: