3 ms·
Yeah, that's all he needed. Making it a comment isn't necessary either. Maybe Node should be strict by default? I can understand it not being the case for brow
by Raticide 15y ago
Yeah, that's all he needed. Making it a comment isn't necessary either.
Maybe Node should be strict by default? I can understand it not being the case for browsers that need to support legacy code, but for Node it doesn't really need to care about that.
- morsch 15y agoHuh. On the scale from pragmatic idiosyncrasy to simply bizarre, making a string literal expression change the runtime behaviour in that manner is fairly wide towards the bizarre end of the scale. I think, if anything, requiring it to be in a comment would have been less odd; at least comments imply a sense of "meta"-ness.
- apgwoz 15y agoYeah, I always thought the string idea was wacko too, but introducing a new keyword in a language that has to be backwards compatible or suffer doom isn't a good idea either.
- bzbarsky 15y agoComments are commonly stripped by various source code processors out there, including minifiers and some browser JS engine front-ends. The string literal doesn't make anyone _happy_, but it was most compatible with the existing widely deployed toolchains, as I understand.
- kijin 15y agoNot to mention that it reeks of VB6's "Option Explicit" and "Option Strict" statements. I hated those.
- masklinn 15y ago> On the scale from pragmatic idiosyncrasy to simply bizarre, making a string literal expression change the runtime behaviour in that manner is fairly wide towards the bizarre end of the scale. Yes, on the other hand it's quite necessary to not have non-compliant browsers blow up. `"use strict";` is just a noop in e.g. IE6. `use strict;` would be an error in it. > I think, if anything, requiring it to be in a comment would have been less odd; at least comments imply a sense of "meta"-ness. Javascript compressors definitely strip comments. They probably don't strip strings.
- mst 15y agoQuite possibly a good idea. use v5.12; in perl code enables strict, at least.
- alunny 15y agoNode itself (the core js library) isn't strict mode compliant: it uses octal literals for filesystem interactions.