3 ms·
The joke goes, "If every other line of code you write starts with 'if err != nil', you might be a Go programmer."
by mdwelsh 13y ago
The joke goes, "If every other line of code you write starts with 'if err != nil', you might be a Go programmer."
- JulianMorrison 13y agoNo, we can just see the "if err != nil". It's still there in Java or Ruby or Python, lurking in the notional space between the lines and waiting to branch to an exception handler you installed in the caller's caller's caller.
- pcwalton 13y agoSame in Go, because of panic and recover. For example, "foo.Bar", if foo is a nil pointer, can invisibly branch to an exception handler you installed in the caller's caller's caller.
- JulianMorrison 13y agoCan but idiomatically, usually does not. In most code, that would behave like a segfault with a more helpful crash log.