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

I agree with the person you are disagreeing with, in this case. Go is being touted as a systems programming language.

My experience of very low level programming is that you want to know exactly what's happening, and especially when things go wrong. And you want to know what's gone wrong right at the point of it going wrong.

Exceptions are the wrong technique for this form of programming. When doing systems work you are spending a lot of time dealing with error situations and hence the handle the error and pass up an error code form is appropriate.



"Systems programming language" is a loaded term, IMO. Many people have used C - probably the canonical systems programming language - inappropriately for applications where better languages would have been more suited. We've paid the price in insecurity, buffer overflows, memory errors, etc. many times over. I think you need to more clearly define what you mean by it.

You can't mean very low level programming, since that is a very small fraction of all programming - and probably not the best domain of a general purpose programming language.

As I mentioned in another comment in this thread, I see exceptions as exactly equivalent to a rigorous approach to error codes.

I also note with interest that you describe the form as "handle the error and pass up an error code". This reads to me as a contradiction in terms. While the error code is still propagating, the error has not been handled. Some intermediate cleanup has perhaps been done, but normal code execution has not yet resumed. Moreover, exceptions have mechanically checkable formalisms for these phases of error handling.


Even in Kernel programming, exceptions are useful. If you read http://www.kernel.org/pub/linux/docs/lkml/#s15-5, you'll see that goto's are used to reduce code duplication for error handling, which is essentially just a poor man's exception. More sophisticated exception handling in C can and has been done with longjmp as well.


Go has goto.

Unlike goto as used in the linux kernel, exceptions will jump up the call stack god knows where.

And in essence exceptions are not goto, but camefrom.


Exceptions jump to the declared handler - i.e. the right place.

I remain convinced that far too many people have gotten wrong ideas about exceptions from the bastardized implementations in C++ and Java.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: