News for hackers. Stuff that matters.
Re:Go and Assembly by tptacek on Thursday February 07, 2013 @03:51PM (#5184424)
Panic and recover are non-idiomatic; using them the way you would exceptions in Python is (stylewise, I mean) a little like using setjmp and longjmp for flow control in a C progam.

In the Go standard library source code, "panic" has pretty much the role 'assert(!"error message")' has in C.

The reality is that Go does not have exceptions the way Python does. If you're writing idiomatic Go, you're manually checking errors.

Re:Go and Assembly by beagle3 on Thursday February 07, 2013 @05:22PM (#5184918)
> Panic and recover are non-idiomatic;

Exactly (and probably for a reason)

> In the Go standard library source code, "panic" has pretty much the role 'assert(!"error message")' has in C.

Well, there's no real way to recover after such an assert (the C stdlib is undefined when you catch the SIGABRT, the stack is not guaranteed to be big enough to do anything, most I/O is not guaranteed to work, etc. -- really, very few uses for catching a SIGABRT). There is a way in Go, even if it is far less capable than your average "except .." clause in C++.

> The reality is that Go does not have exceptions the way Python does.

True. Some of us (e.g. me) think that's a big advantage. (I'm not implying you disagree - I don't know what your opinion is)

Re:Go and Assembly by tptacek on Thursday February 07, 2013 @06:13PM (#5185149)
I'm not a fan of the lack of exceptions in Go, but it's not a dealbreaker for me. I feel like Go code is very cluttered and fussy. I don't love the language as a language. But as a tool for getting systems programming problems solved, it is pretty amazing, and I love working with it.