It's a feature! :)
Seriously, though, it's universally annoying for {foo: "bar"} to
resolve to "bar" rather than {foo: "bar"}. In their haste, Netscape
released Brendan's creation into the wild before it was fully
finished, and in the organic iteration process, we came to have object
literals using syntax that is indistinguishable from blocks (which do
nothing) and labels (which also do nothing). The only way out of the
mess is to wrap in parens, and it has this weird effect on function
calls, or implement a smarter parser than eval(), and that's much more
complicated, or try to be clever about when you wrap and when you
don't, which also adds complexity for little benefit.
It's ok how it is, really.
On Fri, Jun 15, 2012 at 12:29 AM, Adam Blackburn <[email protected]> wrote:
> I just discovered a really magical bug, that may not be significant enough
> to care about.
>
> If you open your node repl and run:
>
> > console.log)("oh hai"
>
> It will happily greet you without any syntax errors.
>
> I found the issue is here, where it wraps your command in parens. So it
> really runs (console.log)("oh hai").
>
> Thoughts? Worth caring about?
>