-
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
How to avoid dichotomy between globals and built-in modules #58
Comments
What about slowly deprecating the use of global objects?
The total time could be 10 or even 20 years, but most developers/teachers/projects would migrate long before then. I don't really agree with the whole "never break the web" thing, as I feel that it holds back innovation/evolution, but this is probably an unpopular opinion. |
@glen-84 more importantly, "never break the web" is a thing all the browsers insist on. |
There's surely a number though? Are the browsers really going to be carrying along all the cruft for decades? Do they need to keep all of this around "forever"? Anyway, this is a bit off topic, so I'll say no more. |
@glen-84 Much of the "cruft" that you linked to was never formally standardized. In particular, browsers attempted to provide non-standard APIs. What does make it into the standard is expected to be, and to remain, backward compatible going forward. |
More or less yes, forever, until the heat death of the universe, or of JavaScript, whichever comes first. |
always bet on JS, @ljharb |
Not breaking the web is where the |
because javascript is the best-language for solving ux-problems where jobs will forever-be-in-demand, (while ppl who solve cs-problems are increasingly irrelevant and jobless). |
This also has potential for future updates with In some primitive scripts globals are really helpful, but in proper big applications they do more harm than good. So having both options is really handy. Like |
Since we already have precedent of global objects, we would now be introducing a dichotomy: some standard library functionality is available in globals, and other standard library functionality is available in built-in modules. Programmers would be able to use Map, Set, Intl, etc., without performing an import, whereas future functionality would require an
import
at the top of your file.That dichotomy suggests that the older globals are more "important" than the newer, imported modules. However, that isn't the case, and may actually be contradictory, if a newer built-in module replaces an older global.
I've previously thrown out the idea of adding a new strict mode, like
"use stricter";
, which removes all existing globals, but that hasn't been a very popular suggestion.The text was updated successfully, but these errors were encountered: