-
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
Not convinced of use cases #59
Comments
i would go further and argue that es-modules were a mistake. sure js-rollups in browsers have issues, but they're all fairly manageable for product-developers and devops. es-modules, otoh, have caused product-developers nothing but endless grief, wasting our time firefighting bugs in unncessary tooling, instead of shipping ux-features. |
A nice example of point 2 is functions that are defined on import { setTimeout, setInterval } from "js:timers";
setTimeout(/* ... */);
setInterval(/* ... */); This is equivalent to: const { setTimout, setInterval } = globalThis; But the former feels cleaner. Usage of |
any engine with these modules is guaranteed to have |
@devsnek The problem is that we developers don’t always write directly for the engines that our users are using, so if our transpilers, linters, or lint rules are not up to date (which—sorry to say—is the case with |
there are also plenty of globalThis polyfills |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I would like to echo some of the concerns of @sffc here. I understood a similar motivation based on the explainer. I would also like to add some of the ones presented in the slides, including namespace collisions (which are a sore point for the committee). The other goals feel like they are not so significant that it is worth splitting into two locations: global and the builtin modules. One of the reasons that I would like to raise, that would show a significant enough motivation, was that this would allow Wasm to import DOM related APIs. I don't know if this is still important (cc @lars-t-hansen). At present, the motivation without this does not seem strong enough to outweigh the potential issues. I would be interested to see if there are more fundamental benefits that we could find here before saying this is a problem space that needs solving. cc'ing @annevk for visibility. |
Here are what I understand as the reasons why the champions feel built-in modules should exist:
On point 1, if I recall correctly, we have heard from browser engine implementors that they are able to lazy-load global objects and achieve good performance. It's already a solved problem. Engines will still need to ship this lazy-loading logic so long as globals continue to exist.
On point 2, I see that argument, but the proposal also brings downsides to code health (main issue: #58).
I also don't understand this: the README says, "The JavaScript language does not have a standard library", which is simply not true; Intl, Regex, Map, and Set are all examples of standard library.
Built-in modules are a big change to the ecosystem, and I am not convinced that the suggested use cases carry enough merit to justify the disruption.
The text was updated successfully, but these errors were encountered: