-
Notifications
You must be signed in to change notification settings - Fork 690
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
WebAssembly.instantiate returning a pair: what attributes do the properties have? #961
Comments
Actually, I think that varying the return type based on the argument is unnecessarily surprising. The functionality is also redundant. This overload is primarily a shortcut for (the majority of) clients who just want the instance. Those that actually need the module can always call So, I would suggest we just get rid of the pair, thereby simplifying |
I think the high-level logic for any app with a sizable wasm module should be (in pseudocode, pretending everything is sync, ignoring versioning, failure etc):
So we definitely need this raw capability and it will be the common case for any beefy app. But it's fine with me if you want to propose having |
@lukewagner, fair enough, but this is even slightly less repetitive: :)
(Probably need to make that an async function and sprinkle in the right awaits in both versions.) Anyway, yeah, if we want this, I'd feel better making it a separate function. I just can't think of a nice name. |
Without the |
@rossberg-chromium I know, but the resolution of #838 is that @jfbastien The problem with that is it would add a GC edge so that instances would keep their modules alive. The module contains metadata needed for structured cloning and instantiation that you want to be able to GC as soon as instantiation/cloning is complete and the module is unreachable. |
What's "that"? Agreed that I'm not proposing anything, I'm asking how one can use the Given your assessment, which solution would you propose? |
@jfbastien "That" would be adding a |
@lukewagner sure. That still doesn't resolve the question I ask. |
|
@lukewagner that won't work if |
I thought that the motivation, alternatives, and design for this were discussed in #838. Assuming we stay the course with the current API - any stance on what the properties should be attributed as? |
@jfbastien Ah, I was already assuming we're keeping the returned pair and only considering the more superficial change of renaming. Personally, I'd rather not, but I'm not all that familiar with what the precedent is for overloads like this. @mtrofin Sorry your root question was lost :) The current wording "On success, the Promise is fulfilled with a plain JavaScript object pair |
Thanks! |
If the return of a WebAssembly.instantiate is the pair with the 2 properties - module and instance - what can we say about those properties? Are they read only, for instance?
The text was updated successfully, but these errors were encountered: