I found out something weird about node.js today:
$ node
> console.log(_)
ReferenceError: _ is not defined
at repl:1:13
at REPLServer.defaultEval (repl.js:130:27)
at bound (domain.js:257:14)
at REPLServer.runBound [as eval] (domain.js:270:12)
at REPLServer.<anonymous> (repl.js:277:12)
at REPLServer.EventEmitter.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:202:10)
at REPLServer.Interface._line (readline.js:531:8)
at REPLServer.Interface._ttyWrite (readline.js:812:14)
at ReadStream.onkeypress (readline.js:101:10)
> function foo() {}
undefined
> console.log(_)
undefined
undefined
The same thing happens after I create a function expression:
$ node
> console.log(_)
ReferenceError: _ is not defined
at repl:1:13
at REPLServer.defaultEval (repl.js:130:27)
at bound (domain.js:257:14)
at REPLServer.runBound [as eval] (domain.js:270:12)
at REPLServer.<anonymous> (repl.js:277:12)
at REPLServer.EventEmitter.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:202:10)
at REPLServer.Interface._line (readline.js:531:8)
at REPLServer.Interface._ttyWrite (readline.js:812:14)
at ReadStream.onkeypress (readline.js:101:10)
> (function () {}())
undefined
> console.log(_)
undefined
undefined
It's pretty cool, and handy for function arguments which you intentionally want to leave as undefined, but why does it happen? I am using node version v0.11.13 on Arch Linux.
<rant>The whole_thing is staggeringly frustrating when you're trying to use code that expects_to be the underscore library. The workarounds are hacky and don't really work; I recompiled to get rid of it--I don't use it anyway.</rant>nodeyou get the repl. But you can load arbitrary code into the repl, or cut-and-paste, etc. If your code includes the_symbol things break rather badly.