> Why would you ever allow indeterminate, unsafe, or code that causes your vm > to implement runtime hacks to work around it to run at all? > Just because the code would run without throwing an exception doesn't mean > that it worked.
Yeah but I've been using that (hypothetical) code for ages and never had a problem with it. Plus, the unit tests pass. Solid empirical data is more than enough for me. > In my mind "working" code is code that runs the same way every time without > ambiguity of execution or intent. AFAIK 'non-strict' code can and does run the same way every time without ambiguity of execution or intent. Especially when it's been used in production and has a reasonable test suite. I find these things more compelling than knowing that the code only used some "safe" subset of the language. --Josh On Wed, Mar 13, 2013 at 11:41 AM, AJ ONeal <[email protected]> wrote: > The better question is: Why would you dare not to? > > Why would you ever allow indeterminate, unsafe, or code that causes your vm > to implement runtime hacks to work around it to run at all? > Just because the code would run without throwing an exception doesn't mean > that it worked. > > (sidenote: I liked that when I upgrade to node v0.10.0 I had to fix some of > my code in one of my projects because it threw exceptions instead of > allowing me to leave out error-handling callbacks. This project skipped from > 0.6 to 0.10, so maybe that was added in 0.8) > > In my mind "working" code is code that runs the same way every time without > ambiguity of execution or intent. > > If a person believes that a function is defined conditionally or that a > variable exists in a particular context when it actually exists in another > one, then it doesn't work. It just runs and hasn't yet defied expectations > (or at least the inconsistency hasn't been noticed and fixed). > > And if you're using JSHint or some other quality checking tool, there's a > good chance that there will be no breakage. > > AJ ONeal > (317) 426-6525 > > > On Wed, Mar 13, 2013 at 1:26 PM, Joshua Holbrook <[email protected]> > wrote: >> >> I seriously don't understand: Why bother? Why make things that used to >> work no longer work? That's basically the only thing that "use strict" >> at the global level will do for you. >> >> --Josh >> >> On Wed, Mar 13, 2013 at 11:21 AM, AJ ONeal <[email protected]> wrote: >> > Ben, >> > >> > That is correct. >> > >> > See http://stackoverflow.com/a/4304187 >> > >> > Although some shells or OSes may allow arguments to shebang, I've had >> > issues >> > with it on my setup (OSX and Linux with Bash and ZSH). >> > >> > And then there's Windows... >> > >> > I believe my solution will also work on Windows, but it's certainly not >> > the >> > ideal solution. >> > I think that would be a native bin that invokes node with strict mode. >> > >> > AJ ONeal >> > (317) 426-6525 >> > >> > >> > On Wed, Mar 13, 2013 at 11:18 AM, Ben Noordhuis <[email protected]> >> > wrote: >> >> >> >> On Wed, Mar 13, 2013 at 6:03 PM, AJ ONeal <[email protected]> wrote: >> >> > Perhaps the very best part of node v0.10.0 is that all of the core >> >> > modules >> >> > are finally fully ES5 compliant!!! >> >> > >> >> > Although, you can't use es5-compliant mode with a shebang >> >> > (because you can't pass the --use_strict argument), >> >> > so I made a shim that will run node in es5 (strict) mode for you. [0] >> >> > >> >> > Install >> >> > >> >> > sudo npm install -g node-es5 >> >> > >> >> > Usage >> >> > >> >> > #!/usr/bin/env node-es5 >> >> > >> >> > (P.S. Dear core devs: please provide a native cli for strict mode >> >> > node) >> >> > >> >> > Except in the case that you're writing code that also runs in the >> >> > browser, >> >> > you can now skip the obligatory >> >> > >> >> > (function () { >> >> > "use strict"; >> >> > >> >> > // code goes here >> >> > }()); >> >> > >> >> > Not that there's any harm in putting it in... but it's just annoying. >> >> > >> >> > You can also take out `strict: true` from your `.jshintrc` for your >> >> > node >> >> > projects. (An `implicitstrict` option may come soon [1]). >> >> > >> >> > Anyway, this is certainly a GIANT step forward in eliminating the >> >> > excuses of >> >> > using bug-prone ES3 code. >> >> > >> >> > Hurrah to the Node Devs! >> >> > >> >> > AJ ONeal >> >> > >> >> > [0]: https://github.com/coolaj86/node-es5 >> >> > [1]: https://github.com/jshint/jshint/issues/924 >> >> >> >> AJ, am I missing something? >> >> >> >> #!/path/to/node --use_strict >> >> console.log('Hello, world.'); >> >> >> >> You're saying that doesn't work for you? >> >> >> >> -- >> >> -- >> >> Job Board: http://jobs.nodejs.org/ >> >> Posting guidelines: >> >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> >> You received this message because you are subscribed to the Google >> >> Groups "nodejs" group. >> >> To post to this group, send email to [email protected] >> >> To unsubscribe from this group, send email to >> >> [email protected] >> >> For more options, visit this group at >> >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> >> >> --- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "nodejs" group. >> >> To unsubscribe from this group and stop receiving emails from it, send >> >> an >> >> email to [email protected]. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> > >> > -- >> > -- >> > Job Board: http://jobs.nodejs.org/ >> > Posting guidelines: >> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> > You received this message because you are subscribed to the Google >> > Groups "nodejs" group. >> > To post to this group, send email to [email protected] >> > To unsubscribe from this group, send email to >> > [email protected] >> > For more options, visit this group at >> > http://groups.google.com/group/nodejs?hl=en?hl=en >> > >> > --- >> > You received this message because you are subscribed to the Google >> > Groups >> > "nodejs" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> -- >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
