3 ms·
How would System.globals be any easier to polyfill? The problem described in this article is how to reliable get access to the global object (or bow globalThis)
by realityking 7y ago
How would System.globals be any easier to polyfill? The problem described in this article is how to reliable get access to the global object (or bow globalThis) in currently shopping JS environments in the first place.
- dmitriid 7y agoAh, true. I re-read the article. You’d need the horrible polyfill anyway. So, my other point still stands: instead of any long-term planning and robust design, TC39 keeps introducing features that are badly specified are underspecified, and that require patches and workarounds in the language itself (yup, .meta, globalThis and some others are nothing but poorly thought-out patches) and conplex workarounds for the various JS environments that may or may not support these features.
- thrower123 7y agoIf Javascript needs anything, it is a breaking change to go back and clean out all the cruft that has accumulated over two decades of being bent and banged and globbed onto. I don't think that that can actually happen, so we just keep trying to cake more lipstick on the pig; maybe in five years we can put it out to pasture and use WebAssembly instead.
- colejohnson66 7y agoAren’t arrow functions and “use strict” attempts to fix common gotchas?
- codedokode 7y agoAccess to global object was intentionally restricted in strict mode and modules and now you (JS devs) want it back. That's not what rational people do.
- realityking 7y agoAccess to the global object is not at all restricted in strict mode. The changes in strict mode related to the global object are: - can’t define implicit global variables (you need to be explicit) - “this” doesn’t refer to the global object The problem is that different host environment have different names for the global object. That’s what make it hard to write code that works independent of the host environment and that’s what globalThis is aiming to fix.