|
|
|
|
|
by 0xABADC0DA
4942 days ago
|
|
Even so why would you write that boilerplate code out each time? Something like this would work even better: result = src.asyncMap { |e| dowork(e) };
Except Google Go returns several values instead of tuples, so you can't just collect all the results as-is. And with no generics it would be annoying to actually use e and the result, since they would need casts. Too bad. |
|
> Except Google Go returns several values instead of tuples, so you can't just collect all the results as-is.
This is false. Functions in Go do not have to return multiple values. Therefore, you can "collect all the results as-is".
> And with no generics it would be annoying to actually use e and the result, since they would need casts. Too bad.
Actually, it wouldn't be annoying, because you wouldn't use a general purpose map like you've shown. You'd use code shown in the parent.