7 ms·
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) }; Exc
by 0xABADC0DA 14y 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.
- burntsushi 14y agoWhy am I not surprised to see you trolling HN too? What's all too sweet is that you've brought your anti-Go zealotry here too! Joy. > 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.
- 0xABADC0DA 14y agoIf you think you can do asyncMap in Google Go, without casts and without manually collecting multiple return values, by all means show us the code. I would find that really interesting.
- burntsushi 14y agoI didn't claim I could. Take your trolling elsewhere.