The - operator is doing numeric arithmetic. I didn't say eval was evil. True enlightenment in software engineering comes beyond such provincial terms as "good" and "evil".
I said eval was "optimization-destroying". In other words, it's slow, and very difficult to ever make fast. If you want to slow your program down, sure, use eval. If you care about performance even a little, you'll figure out a way to not use eval. On Thu, Dec 13, 2012 at 12:53 PM, Ryan Schmidt <google-2...@ryandesign.com> wrote: > > On Dec 13, 2012, at 14:35, Marcel Laverdet <mar...@laverdet.com> wrote: > >>> var myobj = require( the-file ); >>> eval( 'myobjs.' + file-name = myobj;'); >> >> How has no one commented on the fact that you're doing numeric arithmetic on >> a bunch of strings? All this is going to do is give you a parse error, and >> when you fix that you're just doing require(NaN). > > I'm not sure exactly what the original intent was, since there's already a > parse error due to an odd number of quote marks, but I assumed the "+" > operator was being used for string concatenation (not numeric arithmetic). > > -- > 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 nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en