Skip to content

then et al support implicit conversion of objects to promises#2

Merged
jcheng5 merged 2 commits intomasterfrom
joe/feature/as.promise
Sep 16, 2017
Merged

then et al support implicit conversion of objects to promises#2
jcheng5 merged 2 commits intomasterfrom
joe/feature/as.promise

Conversation

@jcheng5
Copy link
Copy Markdown
Member

@jcheng5 jcheng5 commented Sep 7, 2017

future::Future support is built in.

With this PR, you can seamlessly treat regular future() results as promises.

library(promises)
library(future)
plan(multicore)
future({Sys.sleep(1); cars}) %...>% head() %...>% print()

An unsolved problem is that contexts that can take either promises or non-promises (like Shiny render functions) would have no way to know whether to attempt converting something to a promise or not.

@jcheng5
Copy link
Copy Markdown
Member Author

jcheng5 commented Sep 7, 2017

Might also be helpful for docs to point out that this is not how you take a result value and turn it into a promise (like $q.when(valueOrPromise)). Instead, that is promise(~resolve(valueOrPromise)).

@jcheng5
Copy link
Copy Markdown
Member Author

jcheng5 commented Sep 7, 2017

Almost forgot, this PR also includes promise_lapply utility function.

@jcheng5 jcheng5 merged commit d291ae1 into master Sep 16, 2017
@jcheng5 jcheng5 deleted the joe/feature/as.promise branch September 16, 2017 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant