Live data from Hacker News

Ruby methods are colorless

jpcamara.com

241–242 of 242 posts

Re: Ruby methods are colorless

#241
post #105

Earlier quoted context omitted.

Yeah, go's a little boilerplatey, but you have to option to run two sync things concurrently as well with something like: type result[T any] struct { el T err error } chanA := make(chan result[aResultType]) chanB := make(chan result[bResultType]) go func() { defer close(chanA) a := &blah{} rA, err := engine.doSomethingWithA() chanA

Now handle the following that is painlessly solved by runtimes with structured concurrency: If A failed, the whole function is failed, and we don't need B any more. To save resources we should cancel B. And vice versa, cancel A if B failed.

So, context.Cancel?
Post reply on HN