-
Notifications
You must be signed in to change notification settings - Fork 165
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
Alternative interfaces and Lazy promises #98
Comments
I think lazy promises is an interesting idea worth exploring, although I think monads are orthogonal. I like the As always, one question worth asking---especially for something as experimental as this---is what would be gained by specifying, instead of working in library space. One potential answer is that lazy promises could be branded (e.g. For the record, previous related discussions have taken place in: |
That's true. I think if we should specify something like that, we should do it in a more generic way - allowing different promise implementations work together even if they do not support all of such features. My proposal would be message channels in which events can bubble up and down the promise chain, letting consumers interact more closely with the resolution process. Examples for down-messages:
Examples for up-messages:
A conforming implementation would not need to support all of these possible actions, but would need to transport the messages. |
@bergus So, basically incorporating a duplex event stream into the promise interface? That's nice and generic, but it seems to greatly increase the scope and requires coordination between promise consumers and promise publishers/resolvers - essentially, an ad-hoc messaging protocol. |
@bergus, it's an interesting idea, but it needs to be experimented with in user land via libraries before we try and spec it in my opinion. It's worth noting that the two discussions @domenic links to describe 2 very different sorts of lazy promises.
|
I hope I'm not intruding, or re-hashing old ground. But rather than making substantial additions/changes to the existing promise object and its methods, what about a new kind of |
I've had some conversations lately around lazy promises, for example being able to express a pipeline of operations on promised future values independently of initiating evaluation of the underlying value.
Some ideas around this have included requiring a
.done
method to terminate a chain of promises, which could propagate up the promise chain to force the evaluation of a lazy promise resolver.In light of recent "fantasy land" promise discussions, does anyone have any insight around how hypothetical monadic promises might approach this? Similar to Cancel and Progress, Lazy promises are very useful in some situations (eg, for expensive IO operations which may or may not be necessary), but not in every situation.
The text was updated successfully, but these errors were encountered: