Closed zloirock closed 1 year ago
It's definitely not; we explored this in the globalThis proposal.
@ljharb could you provide the results of this research? For example, here you provide only some links to global
and window
.
https://github.com/tc39/proposal-global/issues/11#issuecomment-220802575
There's a number of examples of window and self both implying a browser, such as https://github.com/Microsoft/automatic-graph-layout/blob/ab371280000f4d85eeedc1899e6faaa66ccad009/GraphLayout/MsaglSharpkit/WebMsagl/Msagl/sharpkit_pre.js . In addition, var self = this is too common a pattern for self to be a safe bet.
And here is no self
in examples.
"such as" - that was one example. I recall seeing hundreds of them with a trivial github search; you're welcome to do the same.
Just searching something on GitHub - is not proper research. I hope that it was not your motivation at the time of this proposal? After exploring some examples of such code, I found that they are used only on tests or not used at all. However, sure, with a big chance somewhere it's used in some code where it can break something.
If you're aware of another way to do research that isn't fantastically expensive, I'd love to know about it.
I'm awaiting at least some real examples of what it can break. At least some links to GitHub with an explanation. Otherwise, it's just empty words, not "research". I don't think that it's fantastically expensive. I found some tenths of such cases on GitHub for some minutes - but I don't see the danger in any one of them - however, sure, it's not exhaustively - otherwise, this issue wouldn't be here in this form.
However, for NodeJS it's not principal since they can implement it in a new major release - it's not browsers and breaking changes are possible.
@jasnell @lucacasonato
The final attempt to get feedback, @jasnell @lucacasonato.
We've removed self
For example, I'm worried about NodeJS - in some cases, someone detects the environment as NodeJS like
typeof self === 'undefined' && typeof process === 'object'
.Related: https://github.com/zloirock/core-js/pull/1118