-
Notifications
You must be signed in to change notification settings - Fork 24
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
Reliably accessing built-ins from standard library polyfills #13
Comments
I would like to say that there's a requirement that early-running code can virtualize "originals" from the perspective of late-running code. See domenic/get-originals#18 for justification. Note that I don't believe import-maps would be sufficient for this if builtin modules were deeply frozen, at least as I understand that proposal, because defining or overriding import maps would not be a power programmatically available to early-running JavaScript code. |
@bakkot Is import-maps sufficient in its current state, if get-originals were, itself, exported from a module that could be virtualized? |
@littledan By "could be virtualized", do you mean "by import-maps" or "by JavaScript code"? If the former, no. If the latter, I think yes. |
@bakkot The virtualization would be a combination of import-maps and JavaScript code, right? |
Are import maps planned to be part of the language along with builtin modules? |
If early-running JS code cannot programmatically modify import-maps, then no, that would not be sufficient. Specifically: it is currently the case that a library A can redefine, for example |
@ljharb Not currently. Let's discuss that issue in #2 . My view is that we can be flexible about standards venue as long as there's a good solution available to JavaScript implementations that want to support virtualization (which presumably would include the Web and Node.js). @bakkot The current import-maps specification lets scripts that run before any module insert import maps. See https://github.com/domenic/import-maps#dynamic-import-map-example for an example. |
@littledan Ah! I'd missed that, thank you. I believe that could be enough, yes, though I'd need to think more about it to be sure. (Part of the problem is that import-maps doesn't lend itself very well to wrapping modules, as opposed to just replacing them.) |
The more I think about it, the less I understand how we could possibly make the built-in modules that always have the original values/a frozen copy work. Has anyone thought through what the semantics should be? At the same time, the get-originals proposal (if it were a built-in module, so it's virtualizable but you have a central point of control which is the import-map) seems like a good solution. As far as WebAssembly goes, I don't see why get-originals wouldn't work well for that either. |
@domenic 's get-originals proposal provides a mechanism for reliably accessing built-ins. There is another suggestion to do this via built-in modules.
Get-originals is proposed as a web platform API, but this capability could be useful across multiple JavaScript environments. Should we make get-originals available across JavaScript environments, try to pursue something as part of this proposal (as @mattijs suggested), or both? What requirements do we have on a mechanism like this?
The text was updated successfully, but these errors were encountered: