On 31 July 2012 09:15, Popog <
pop...@gmail.com> wrote:
> This just makes me think of exceptions in go. Go took exceptions and made
> them technically capable of doing try-catch if you work really hard at it,
> but it's not easy to do. So instead they are used to for truly panic worthy
> stuff. However, because try-catching-like behaviour is still useful,
> packages like "encoding/json" can use them to take some of the headache out
> of it's error handling.
>
> As abuse is the primary concern with this feature, I suspect a similar
> mitigation is possible. To me, being in the runtime package was warning
> enough. It seems that everyone disagrees with me, so I'd love to hear some
> suggestions as to what the barrier to usage should be in order to limit
> abuse.
Goroutines are used very differently to threads. It is common for a
request to be handled by many goroutines, and frequently the goroutine
that finishes a request is not the one that first handled it. Knowing
the goroutine in which code runs is, 99% of the time, not useful as
context. If we introduced goroutine-local storage people would write
code assuming that it is, and that would be wrong.
It is just not going to happen.
Andrew