|
@hooraybuffer | |||||
|
Accidentally invented a new feature. Should the JS console/REPL in DevTools stay in strict mode (for later evaluations) if you set it once? It doesn't currently :(
|
||||||
|
||||||
|
Marja Hölttä
@marjakh
|
20. ruj |
|
If it was sticky, what would you need to do to go back to sloppy?
|
||
|
|
||
|
Peter Marshall
@hooraybuffer
|
20. ruj |
|
There's no way to do that. You could use an eval :). Or we could add something (button or 'use sloppy'). You'd be stuck. But this is the same if you put 3 statements in the REPL vs. those 3 statements together in one REPL input.
|
||
|
|
||
|
David Mark Clements
@davidmarkclem
|
20. ruj |
|
I think a “mode” dropdown selection the console:
Strict
Sloppy
Module
Since module context is similar but not quite the same behaviour as strict mode
|
||
|
|
||
|
Peter Marshall
@hooraybuffer
|
20. ruj |
|
Cool idea. We would need to figure out what happens if you select e.g. sloppy and then write 'use strict' - does it change the dropdown permanently or only for that input? And other interactions like that.
|
||
|
|
||
|
Aleksey Kozyatinskiy
@ak_239
|
20. ruj |
|
I prefer UI toggle that controls default mode. So if the expression contains "use strict" by itself it overrides toggle for current evaluation but does not change the toggle.
It looks like we finally need the spec for REPL to cover all existing problems, e.g., top-level await...
|
||
|
|
||
|
Peter Marshall
@hooraybuffer
|
21. ruj |
|
Eventually a spec will be the way to go, yes. We can experiment in the meantime 😈
|
||
|
|
||
|
Vítězslav Ackermann Ferko
@vitezslavferko
|
20. ruj |
|
There could as well be a toggle in Console settings.
|
||
|
|
||
|
Kenigbolo 🇫🇮🇬🇧🇳🇬🇬🇭
@expensivestevie
|
20. ruj |
|
This!!! I strongly recommend a toggle
|
||
|
|
||
|
Felix Kling
@fkling42
|
20. ruj |
|
I'd probably just want a checkbox that I could toggle, but not sure if that is even possible. But anyway, if the behavior is "sticky" there needs to be some visual indicator whether strict mode is enabled or not.
|
||
|
|
||
|
Mark S. Miller
@marksammiller
|
20. ruj |
|
Would prefer to start strict and stay strict. Sloppy should be seen as an ES3 compatibility mode, nothing more. Would prefer sloppy mode to become an obscure feature that most JS programmers should never even need to be aware of. It should never be the default setting.
|
||
|
|
||
|
Yang Guo
@hashseed
|
20. ruj |
|
DevTools REPL is for developers of any level of experience to experiment. It should reflect what people experience from regular usage of JS. Sloppy mode is the default in JS, for the better or worse.
|
||
|
|
||