-
Notifications
You must be signed in to change notification settings - Fork 217
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
General mechanism for synchronous access #518
Comments
@katelynsills the code I'm thinking of is: function sync(value) {
if (!value || !value.then) {
// Not a Thenable. So, we can access it synchronously.
return value;
}
// Try unwrapping the promise.
return HandledPromise.unwrap(value);
}
function foo(resultP) {
const result = sync(resultP);
// result should be defined if resultP can be obtained synchronously
} |
I like this a lot. I'm wondering about the |
Yes, |
Ok, sounds good to me! |
Are we talking about two operations rather than one, or are we just talking about the name of the one operation? I think I'm missing some context. I think we only need one operation, that should always return a non-promise non-thenable immediately. |
I think @michaelfig is saying that E.unwrap() needs to remain as is, but I can make my own helper function |
@michaelfig does |
@erights No particular purpose. Shall we change |
Yes, thanks! |
Closes #518 This makes unwrap a lot more useful in the case when the calling code may or may not be in a different vat than the supplied argument.
Closes #518 This makes unwrap a lot more useful in the case when the calling code may or may not be in a different vat than the supplied argument.
This makes
unwrap(foo)
useful when foo is not a Promise at all.The text was updated successfully, but these errors were encountered: