Live data from Hacker News

Wat

destroyallsoftware.com

41–50 of 103 posts

Re: Wat

#42

Guess I'm not a hacker? It's like watching a rerun I've seen twice over with the laugh track turned up to 11 (just to clarify, someone said it was a repost but I haven't seen it before).

There's no laugh track; that's the audience.

Re: Wat

#43

Interestingly the results from jsc, are different from node.js: ----- jsc ------ [] + [] > [] + {} [object Object] > {} + [] 0 > {} + {} NaN ------ node.js ------ > [] + [] '' > [] + {} '[object Object]' > {} + [] '[object Object]' > {} + {} '[object Object][object Object]'

I don't even understand what the last node.js entry is. Is that an array with two objects?

Also, I'm on an old version of node, but my output matches jsc.

Re: Wat

#44
How does this have anything to do with a sense of humor specific to hackers? Don't all professionals enjoy jokes about their field?

Re: Wat

#45
post #43

Interestingly the results from jsc, are different from node.js: ----- jsc ------ [] + [] > [] + {} [object Object] > {} + [] 0 > {} + {} NaN ------ node.js ------ > [] + [] '' > [] + {} '[object Object]' > {} + [] '[object Object]' > {} + {} '[object Object][object Object]'

I don't even understand what the last node.js entry is. Is that an array with two objects? Also, I'm on an old version of node, but my output matches jsc.

The `toString` of two Object-s concatenated, I think.

Re: Wat

#46
post #19

Earlier quoted context omitted.

It's jsc (comes with Webkit) - it's present on Mac OS X by default in /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc You can just do: sudo ln /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /bin/jsc To be able to invoke it directly from the command line.

Thanks, I'll look how to get this working on linux.

At least Arch has `js`package which gives you js command to obtain JS shell; in fact it is just Mozilla's SpiderMonkey. Anyway, the best option for "standalone JS" is node, mainly because it has a sane way of importing code from other files.

Re: Wat

#47

Interestingly the results from jsc, are different from node.js: ----- jsc ------ [] + [] > [] + {} [object Object] > {} + [] 0 > {} + {} NaN ------ node.js ------ > [] + [] '' > [] + {} '[object Object]' > {} + [] '[object Object]' > {} + {} '[object Object][object Object]'

This appears to be a peculiarity of the REPL implementations, not a difference between V8 and JSC. d8 (and the Chrome console) behaves the same way as jsc, while you can make d8 and jsc behave the same as the node REPL by wrapping each statement in parentheses:

  d8> ([] + [])
  
  d8> ([] + {})
  [object Object]
  d8> ({} + [])
  [object Object]
  d8> ({} + {})
  [object Object][object Object]
So I believe this is merely erroneous behavior of the console, not a weirdness of JavaScript itself.

Re: Wat

#48
post #43

Interestingly the results from jsc, are different from node.js: ----- jsc ------ [] + [] > [] + {} [object Object] > {} + [] 0 > {} + {} NaN ------ node.js ------ > [] + [] '' > [] + {} '[object Object]' > {} + [] '[object Object]' > {} + {} '[object Object][object Object]'

I don't even understand what the last node.js entry is. Is that an array with two objects? Also, I'm on an old version of node, but my output matches jsc.

The other reply is right, to clarify String({}) === "[object Object]"

I think the actual video was a little misleading, [] + {} == the string "[object Object]" not an object. The square brackets are just part of the tostring method and are unrelated to the square brackets of arrays.

Re: Wat

#49

What presentation software is he using? Is he just jumping from his slide deck into a shell?

It's Keynote. I recorded those sessions as screencasts, then sliced them into tiny pieces so I can advance them perfectly with my talking. There are 37 slides in that four-minute talk. In some cases, the slices are only two or three frames long.

Ah that makes sense, thank you. I may steal that idea for future talks with R. Though, just embedding a shell in a slide deck would be very nice.

Re: Wat

#50
post #47

Interestingly the results from jsc, are different from node.js: ----- jsc ------ [] + [] > [] + {} [object Object] > {} + [] 0 > {} + {} NaN ------ node.js ------ > [] + [] '' > [] + {} '[object Object]' > {} + [] '[object Object]' > {} + {} '[object Object][object Object]'

This appears to be a peculiarity of the REPL implementations, not a difference between V8 and JSC. d8 (and the Chrome console) behaves the same way as jsc, while you can make d8 and jsc behave the same as the node REPL by wrapping each statement in parentheses: d8> ([] + []) d8> ([] + {}) [object Object] d8> ({} + []) [object Object] d8> ({} + {}) [object Object][object Object] So I believe this is merely erroneous b…

No, it's more subtle than that. By wrapping in parenthesis, you're making it an expression. When you just say "{}+[]" in e.g. Chrome, the first {} is parsed as a block. So what you see printed is the result of "+[]", which is 0. This is why {}+[] is not equal to {}+[] without parens. This may also be why Node gives different results; I'm not sure.

I didn't mention any of this in the talk (it would've killed the flow ;). Instead, I glossed over it and interpreted the syntax as any sane programmer would.

Post reply on HN