6 ms·
>> We've since found exceptions, Maybes, and friends which are very powerful. I think, and someone correct me if this is wrong, that implementing exceptions in
by marktangotango 12y ago
>> We've since found exceptions, Maybes, and friends which are very powerful.
I think, and someone correct me if this is wrong, that implementing exceptions in Go is prohibited by go routines.
The stereotypical way to implement exceptions is using setjmp/longjmp which unwind the stack back to a known location. Since go routines are implemented as continuations, any particular executing go routine may or may not have it's stack in context, and I'm not sure what it means to unwind stacks across multiple continuations, ie is it even possible?
So that's one possible example.
- pcwalton 12y ago> I think, and someone correct me if this is wrong, that implementing exceptions in Go is prohibited by go routines. No. Go already has all the runtime functionality necessary to support exceptions via panic/recover.