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

Re nil:

He said he rarely sees code fail because of nil dereferences, not that he rarely sees it. "if err != nil {" is probably the most commonly written line of Go code by a large margin. Nil fits well with the language's zero defaultness of values. It may not be theoretically sound, but in practice it fits within Go very well and rarely causes the problems it tends to in other languages with null.



Yep. A zero value is very handy. Not having it would make a lot of code needlessly complex just to avoid the boogeyman of nil/null.


Null boogeyman? It's inventor doesn't seem to think so:

http://www.infoq.com/presentations/Null-References-The-Billi...




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

Search: