
Wat - abahgat
http://www.destroyallsoftware.com/talks/wat
======
eggbrain
Wow, this title suffers from some serious editorializing. What's next, "10
ways to know if you are a hacker? (cracked.com)"

~~~
famousactress
I feel like we've been suffering extra-much from this effect lately...

------
program

       $ php -r '::'
       Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
    

Wat

~~~
dangrossman
Pffth, you just need to learn Hebrew before you learn PHP. That says "double
dot twice".

------
nodesocket
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]'

~~~
lftl
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.

~~~
esrauch
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.

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

~~~
abahgat
That is exactly what I was wondering: what you say must be true, but I could
not find any equivalent of what you see here for any other profession.

But maybe it is just because I write code for a living...

------
there
that weird behavior of javascript can actually be used for xss attacks, by
being able to assemble strings. for example:

    
    
       (![]+[])[+!+[]]
    

produces an "a".

<https://news.ycombinator.com/item?id=1153383>

~~~
jrockway
But of course, anyone that actually wants to protect against XSS attacks won't
allow user input to be evaluated. If they did want to allow user-supplied
Javascript, they wouldn't blacklist, they would whitelist (by parsing the
user-supplied script and using the AST to emit only whitelisted operations).

------
angli
This is incredibly funny, but does anyone know why the interpreter makes such
bizarre decisions? Why wouldn't it be preferable to just throw up errors?

~~~
tzs
The Ruby stuff apparently isn't bizarre. From what I've read, Ruby creates
variables as it encounters an assignment to them when parsing the code. So,
when you have

    
    
       a = a
    

in your code, Ruby creates the variable a before it ever tries to actually
execute the assignment. If later, when it has finished parsing everything, and
starts executing, that statement fails because b is not defined, you still end
up with variable a being defined, and since it has not had anything
successfully assigned to it, it has a value of nil.

The JavaScript stuff, I think, comes from operator overloading. The plus
operator is overloaded to allow adding strings to concatenate them, and it
will do type conversion to get compatible types, so "wat"+1 results in the 1
being converted to a string, and then the strings are concatenated. Since the
minus operator is not so overloaded, "wat"-1 instead is treated as numerical
subtraction. JavaScript allows string to be used as numbers, so "123"-1 gives
122. However "wat" is not a string that represents a number, so gives NaN when
forced to be treated as a number, and "wat"-1 is thus NaN.

~~~
lucisferre
Thanks for that. I was curious the reason, it seems obvious though after an
explanation.

------
flatline
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).

~~~
jh3
Really? You don't think this is funny at all? Maybe it's because I'm in my mid
twenties, but I think my father would even find this funny and he knows little
to none about programming.

~~~
flatline
The humor is playing on an inclination to laugh at things we don't understand,
which seems counter to the hacker ethos. Software is hard, and there may be
deep reasons in the dynamic type systems that cause these languages to work
like this, or there may not be, but either way this type of thing is
interesting and seems to demand some further explanation and/or justification.
I find it interesting but don't get the humor. Perhaps, as you implied, I'm
just too old.

~~~
michaelfeathers
> The humor is playing on an inclination to laugh at things we don't
> understand

I think is simply laughing at absurdity: the gulf between intention and
actuality. We have quite a bit of that.

------
phzbOx
For some reason, what I find the most hilarious here is reading the _extremely
serious_ HN comments. It's a weird contrast.

------
farnsworth
I guess this is where we all complain about HN finally jumping the shark and
turning into Reddit.

------
hchinchilla
Does anybody knows which is the javascript interpreter he is using on the
screencast?

~~~
GuiA
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.

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

~~~
mbq
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.

------
nabilt
The presenter also has a catalog of screencasts here
<https://www.destroyallsoftware.com/screencasts>. Haven't listen to them, but
the topics look interesting.

------
glhaynes
Have I been pronouncing "wat" wrong all this time? I just assumed it was like
"what" but ... not.

~~~
gnarbarian
No. I'm with you man. The way he said it was seriously bugging me. At the same
time I couldn't justify my annoyance with an alternative pronunciation that
made sense.

Perhaps some memes should never be vocalized.

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

~~~
garybernhardt
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.

~~~
tylerritchie
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.

~~~
garybernhardt
I like the sliced screencasts because they're so repeatable. I practice my
talks a lot, and I can get the timing down perfectly because it's always the
same. Highly recommended. :)

~~~
chaz
The preparation really shows -- great job. Ability to present really well is a
critical skill for anyone with a product head.

------
orbitingpluto
Array(16)

That's 15 commas, not 16.

~~~
tlrobinson
Handy way to make some padding:

    
    
        function pad(n, c) { return Array(n+1).join(c); }
    
        // pad(6, "-") === "------"

------
bgarbiak
What's the "correct" ("less funny"?) result of

    
    
       Array(16).join("wat" - 1) + " Batman!"
    

?

Empty strings separated with _NaN_ s look perfectly logical to me (I'm a JS
guy though, so, well, bear with me).

~~~
weavejester
That's probably one of the more logical examples. I'd have expected an
exception from any other language, though (Javascript I know doesn't tend to
type error).

------
libraryatnight
Even with my limited programming knowledge I laughed a lot through this.

------
jrockway
I guess you had to be there. I can see why someone might find this funny, but
honestly, nothing is that funny. Some behavior in Javascript is surprising,
but not _that_ surprising.

~~~
marshray
If you've ever gone through a phase (or a graduate degree!) of thinking deeply
about programming language design, you might, as I do, find Javascript's
expression evaluation behavior to be just about the funniest thing around.

~~~
jrockway
I have but I don't. Javascript was designed to reduce programmer-visible
errors at the cost of making it nearly impossible to write a correct program.
At that goal, it succeeds, and [] + {} being NaN makes perfect sense under
those constraints.

------
iapetos
why do i have to signup to know who much it costs to subscribe. I think it
should be apparent on the home page.

EDIT ok my bad it was mentioned on the screencasts homepage

~~~
garybernhardt
It's on the front page, but at the bottom. DAS is a small one-man business, so
I did the design myself (and I'm not a good designer). Sorry about that. :)

------
nessus42
I think that a hacker would also realize that the title makes no claim
whatsoever about the hacker status of those who don't laugh.

------
conbtl
Congrats to all of you who laughed. You are all great hackers. I don't find
this remotely funny.

------
baby
if you laugh, you know ruby.

------
overshard
This is the greatest video ever.

------
greenpizza13
This is hilarious!

------
felideon
At work people always tell me "You IT guys are all so funny."

------
brudgers
Quicktime? We don't need no stinking web standards!

------
chetan51
WAT

~~~
Karunamon
Wat.

~~~
liquidchaz
Wat?

~~~
JosephHatfield
Wat? Isn't that somewhere in Cambodia?

------
franciscoapinto
This is a repost, but whatever. Hopefully people who haven't seen it before
will enjoy it.

------
qqqqqq
Hilarious! This reminds me of a StackOverflow question which asked the users
for the weirdest language quirks they could think of. I laughed pretty hard at
that too.

------
stevenou
Wow, I laughed so hard I cried! This is hilarious...

~~~
nekomata
wow, you must be the best hacker ever congrats

~~~
stevenou
I understand the downvotes since this is HN and you people don't like useless
comments here. But I simply thought it was very funny. No need to be mean
here.

~~~
billpatrianakos
For the record, the downvotes aren't to be mean. We just don't want this
turning into a Reddit clone and/or fill the comments with run-of-the-mill
comments you'd see on any PHPbb forum.

No, I wasn't one of the ones who downvoted you and no, I'm not trying to be
mean. There used to be times I wondered why an innocent comment of mine was
downvoted and thought I'd just let you know instead of leave you hanging.

~~~
stevenou
Thanks for the reply. Perhaps I was unclear. I completely understand the
downvotes - that's why they're on the site. But I thought the "wow, you must
be the best hacker ever congrats" comment was unnecessary and mean-spirited.

------
murphysbooks
I laughed so loud I scared myself. Now, I know why my wife looks at me funny.

