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

WIP: Add antiResolve #24

Closed
wants to merge 2 commits into from
Closed

WIP: Add antiResolve #24

wants to merge 2 commits into from

Conversation

erights
Copy link
Member

@erights erights commented Aug 11, 2019

WIP Adds a Promise.antiResolve(promise) -> presence static method to Promise, to provide synchronous access from a fulfilled handled promise to its fulfillment. This would enable, for example, Purse.depositAll(paymentP) to avoid an extra turn by insisting that Promise.antiResolve(paymentP) not be undefined. In that case, it should be the payment itself, which can then be handled synchronously.

Avoiding the extra turn in that case makes it possible for the purse to process such messages in the order then come in, and makes it possible for the client, in the common case, to avoid forcing a round trip which would lose the benefits of promise pipelining.

WIP because of missing tests, need to bikeshed name and where to put it, and explaining better what this is and why it is needed. Not a candidate for merging until then, but making available as a pull request now to gather feedback.

@michaelfig
Copy link
Member

Bikeshedding a name: How about Promise.getPresence(myP)?

Having looked at your ERTP patch, this makes sense to me as an API. I think it really should live on the Promise global, as it is part of the support that should be available for standard handled promises.

@warner
Copy link
Member

warner commented Dec 1, 2019

note: this PR needs to be migrated to the new monorepo in agoric-sdk

@michaelfig
Copy link
Member

michaelfig commented Dec 10, 2019

Maybe: HandledPromise.unwrap(p) which throws if p is not a resolved handled promise, otherwise return the presence/fulfilled value.

Holidays are here, so I'd like to unwrap my presence.

@erights
Copy link
Member Author

erights commented Dec 10, 2019

I like unwrap

@erights
Copy link
Member Author

erights commented Apr 8, 2020

The point of this change, adding HandledPromise.unwrap, was already merged by another PR by @michaelfig , so closing this one.

Noting that we're likely to remove HandledPromise.unwrap anyway, as it is too hard to use correctly.

@erights erights closed this Apr 8, 2020
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.

3 participants