Closed wch closed 6 years ago
This is a question of R language precedence. The entire rest of the snippet after function(resolve, reject)
is being treated as the body. Like this:
function(resolve, reject) {
{
resolve(1)
} %...>% (function(x) {
print(x)
})
}
In cases where the syntax is correct (i.e. put parens around the first anonymous function) then you get the expected error: "Don't know how to convert object of class function into a promise"
For example, I had some code where I was essentially doing something like this:
It didn't give any errors, but it certainly didn't work as I had expected, and it took me a long time to figure out why (async stuff is hard enough to reason about as it is).
Alternatively, it would be nice if the lhs could be promoted to a promise in cases like this.