[Request] Enable the this keyword.
It would be really useful to have access to the `3this` keyword while using classes.
Sandbox-breakiness can be limited by calling the script's function with `1.``Jcall``1(``3null``1, [``l/* args */``1])`
This way, when someone uses `3this` in the root of the script, they just get `3null` instead of whatever would be there from the script wrapper.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
That has never been the main worry with `Cthis`. Strict mode covers that case entirely already, there's no need for the .call. The worry is finding a way around strict mode (there are tons and tons of non-strict standard/built-in/core JS functions that could .call *any* function with the global as its `Cthis`). Having `Cthis` anywhere is a risk. There's no way to avoid that risk without re-writing the entire core set of JS functions. So the question becomes: how much risk is acceptable? Current answer: none. Given how bad the consequences of getting the global are... I'm not sure why scripting convenience (`Cthis` is never required, anything that can be done with it can be done without it) is enough of a reason to take on more risk, personally.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
That has never been the main worry with `Cthis`. Strict mode covers that case entirely already, there's no need for the .call. The worry is finding a way around strict mode (there are tons and tons of non-strict standard/built-in/core JS functions that could .call *any* function with the global as its `Cthis`). Having `Cthis` anywhere is a risk. There's no way to avoid that risk without re-writing the entire core set of JS functions. So the question becomes: how much risk is acceptable? Current answer: none. Given how bad the consequences of getting the global are... I'm not sure why scripting convenience (`Cthis` is never required, anything that can be done with it can be done without it) is enough of a reason to take on more risk, personally.
Oh, I see.
So, another thing then: What if `3this` was automatically replaced in the functions that we declare with some sort of preprocessor magic, to something that is safe?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This could maybe be done, but it'd be awkward and require a lot of automagic script re-writing, and all it takes is one bad function call/apply and everything explodes.
Really, the global just needs to be made safe. Once it's definitely 100% safe and locked down and nothing can be done with it, `Cthis` becomes fine. I think it's close, but i'm not sure if it's 100%.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -