Twitter | Pretraživanje | |
Peter Marshall
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 :(
Reply Retweet Označi sa "sviđa mi se" More
Marja Hölttä 20. ruj
Odgovor korisniku/ci @hooraybuffer
If it was sticky, what would you need to do to go back to sloppy?
Reply Retweet Označi sa "sviđa mi se"
Peter Marshall 20. ruj
Odgovor korisniku/ci @marjakh
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.
Reply Retweet Označi sa "sviđa mi se"
David Mark Clements 20. ruj
Odgovor korisniku/ci @hooraybuffer @bmeurer
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
Reply Retweet Označi sa "sviđa mi se"
Peter Marshall 20. ruj
Odgovor korisniku/ci @davidmarkclem @bmeurer
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.
Reply Retweet Označi sa "sviđa mi se"
Aleksey Kozyatinskiy 20. ruj
Odgovor korisniku/ci @hooraybuffer
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...
Reply Retweet Označi sa "sviđa mi se"
Peter Marshall 21. ruj
Odgovor korisniku/ci @ak_239
Eventually a spec will be the way to go, yes. We can experiment in the meantime 😈
Reply Retweet Označi sa "sviđa mi se"
Vítězslav Ackermann Ferko 20. ruj
Odgovor korisniku/ci @hooraybuffer
There could as well be a toggle in Console settings.
Reply Retweet Označi sa "sviđa mi se"
Kenigbolo 🇫🇮🇬🇧🇳🇬🇬🇭 20. ruj
Odgovor korisniku/ci @vitezslavferko @hooraybuffer
This!!! I strongly recommend a toggle
Reply Retweet Označi sa "sviđa mi se"
Felix Kling 20. ruj
Odgovor korisniku/ci @hooraybuffer
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.
Reply Retweet Označi sa "sviđa mi se"
Mark S. Miller 20. ruj
Odgovor korisniku/ci @hooraybuffer
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.
Reply Retweet Označi sa "sviđa mi se"
Yang Guo 20. ruj
Odgovor korisniku/ci @marksammiller @hooraybuffer
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.
Reply Retweet Označi sa "sviđa mi se"