Hacker News new | ask | show | jobs
by gant 2893 days ago
I'm a little bit concerned because the last package that Google seems to have purpose-built for Go+Google (AppEngine?) was context, that gave us things like context.Context, a generic KVS that needs reflection, heavily relies on convention and doesn't work in linear time and "just make every function take a context and use context.TODO if you don't need it".

It also seems to be one of the biggest points of controversy for Go 2, with calls from "everything should have a context" to "context should go away".

2 comments

yeah, that context thing is a huge mess.

The libraries that support it have now all their function signature way longer, and it is not well understood if it is a "Request for cancellation" or something else

Context is a pet peeve of mine. It's a design mistake as implemented, even if it serves an important function. It infects everything, forcing every method to pass contexts around, and it conflates multiple separate concerns (cancellation, deadlines, and key/value data).

Given that all of a Go program sooner or later will need contexts somewhere, it would be much cleaner to let goroutines have this stuff implicitly. I don't know enough about the intervals to say whether this is feasible with the current runtime, though.

People really seem to dislike context in the standard library too:

https://github.com/golang/go/issues/20280