-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Why return function ref ? #855
Comments
Could you elaborate? It's not clear to me what you are trying to achieve and how Q is involved in it |
That's my problem with this document design/README.md. |
If you don't call ref on the callback value, the callback might not return a promise and then you wouldn't be able to call p.then(...).then(...) |
I try only to use "callback(value)". it would be able to call p.then(...).then(...) |
Of course, there is a school of thought that promises should be strict monads, in which case, the author of the callback would be obliged to wrap/lift the return value in order to satisfy the type of So |
So p.then(() => 1) would return a promise. |
Now, we need to start altering our "then" methods so that they return promises for the return value of their given callback. The "ref" case is simple. We'll coerce the return value of the callback to a promise and return that immediately.
I try only to use "return callback(value)", It doesn't seem to be a problem,Can you provide an example (" return callback(value) ")?
Thanks.
The text was updated successfully, but these errors were encountered: