Does anyone have an example of a piece of code where a Future that returns a Future? Can be JS too: a Promise that returns a Promise. I'm curious when this might be used, rather than just having it be a theoretical example.
-
-
Replying to @yoshuawuyts
Seems like an anti-pattern (and someone who works on C# made this argument to me in response to the await thread)
1 reply 0 retweets 1 like -
Replying to @withoutboats @yoshuawuyts
Well specifically if it *just* returns a future, what good is the intermediate future? But there are futures that return tuples of futures and other things, like select
2 replies 0 retweets 2 likes -
Replying to @withoutboats
Heh, yeah I was thinking like with Java you have a constructor that returns constructors aka "factory", perhaps there was something similar for futures. Interesting about the tuples tho. I hadn't thought about their interactions with syntax.
1 reply 0 retweets 1 like -
Replying to @yoshuawuyts @withoutboats
Sometimes you want to return an intermediate result, which you can do by returning a struct or tuple containing the future. The awaits would be split across lines anyway though
1 reply 0 retweets 1 like -
I think there's a bunch of places nested futures may be more useful for when you're writing futures code without a tokio executor (or perhaps without any executor at all) but I'm not sure
2 replies 0 retweets 0 likes
I haven't seen this come up when using Romio yet. I'd be curious to see a pattern where this happens.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.