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

This is completely another level of "issues" than other problems in this thread. During code review I'd only mention it as a nit. The longer form is correct and the only downside is that's a bit longer. It doesn't mess up code modularity or affect maintainability in a noticeable way.

Well, assuming that the language doesn't have any quirks in this area - e.g. in Java your statements aren't equivalent for a Boolean x.



Nitpick (as in general you are right regarding java as well): I’m fairly sure they are the same for java in this instance. Both will convert Boolean to boolean, throwing an NPE if it was a null.


Ha, that's true, thanks! I guess my Java-fu is weak these days :)


They're not equivalent in many languages (JS, C++/swift with operator overloads, if x is nullable etc. etc.).




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

Search: