Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$then should check that input is a function #42

Open
wch opened this issue Mar 9, 2019 · 1 comment
Open

$then should check that input is a function #42

wch opened this issue Mar 9, 2019 · 1 comment

Comments

@wch
Copy link
Collaborator

wch commented Mar 9, 2019

The then() function gives an error when a non-functionable object is passed to it:

promise_resolve("start") %>%
  then("then") %>%
  then(function(value) { message(value) })
#> Unhandled promise error: Don't know how to convert object of class character into a promise

However the $then() method doesn't give an error. I'm not sure what it's doing:

promise_resolve("start")$
  then("then")$
  then(function(value) { message(value) })
#> start
@jcheng5
Copy link
Member

jcheng5 commented Mar 9, 2019

I think I was just being extremely conservative with the R6 interface and sticking to the JS promise spec, which specifies that non function arguments are no-ops. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then

Doesn't seem like a helpful policy, I agree...

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

No branches or pull requests

2 participants