Live data from Hacker News

Wat

destroyallsoftware.com

21–30 of 103 posts

Re: Wat

#21
post #3

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?

JavaScript has a strong design principle of not throwing errors for syntactically valid constructs. The most common way it accomplishes this is through gratuitous use of implicit type conversions. It does a lot of implicit string conversions, even on things that you would think of as error codes, like undefined or NaN.

JavaScript went down the path of being a "forgiving" language because it was intended to provide "extra" (non-core) functionality, under a lot of environments, in the hands of non-experts. It made sense at the time that it should fail silently rather than noisily to not crash the page it was on. It also tried to help amateurs who just banged on code until it did what they wanted, by generally doing something rather than nothing, and by trying to infer intended behavior from undisciplined code. It was never intended to make large-scale or robust applications, so it didn't make decisions that would facilitate that use-case.

Re: Wat

#25
post #24

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

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

Re: Wat

#27
post #21
post #3

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?

JavaScript has a strong design principle of not throwing errors for syntactically valid constructs. The most common way it accomplishes this is through gratuitous use of implicit type conversions. It does a lot of implicit string conversions, even on things that you would think of as error codes, like undefined or NaN. JavaScript went down the path of being a "forgiving" language because it was intended to provide "e…

I wish there was some technology that could take a bunch of code and warn you of common errors before having it execute and 'noisily crash the page it was on'.

Maybe someday...

Re: Wat

#29
post #19

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

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.

Re: Wat

#30
post #24

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

  $ php -r '::'
  Parse error: parse error in Command line code on line 1
How'd you get the weird error?

Edit:

Hrm, if I try it on my DreamHost account, I get something more similar to yours:

  $ php -r '::'
  Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in Command line code on line 1
Post reply on HN