Live data from Hacker News

The Birth and Death of JavaScript [video]

destroyallsoftware.com

41–50 of 236 posts

Re: The Birth and Death of JavaScript [video]

#41
post #32

Earlier quoted context omitted.

My scandinavian friends call it yay-va-script.

I'm Icelandic and we use yava-script, I find it hard to figure out how yay-va sounds.

Perhaps it would help to see that pronunciation rendered in IPA for English [0]: /ˈiː.və.ˌskrɪpt/

Note particularly the italicized phoneme (), which corresponds to the "long A" sound in English, e.g., the 'a' in 'face'. I'm unfamiliar with the Icelandic language, but according to the English equivalents listed on Wikipedia's page on IPA for Icelandic [1], the corresponding phoneme in that language appears to be ei.

[0]: http://en.wikipedia.org/wiki/Help:IPA_for_English

[1]: http://en.wikipedia.org/wiki/Help:IPA_for_Icelandic

Re: The Birth and Death of JavaScript [video]

#42
I suspect Nashorn, the just released edition of JavaScript for the JVM, will be heavily promoted by Oracle and become heavily used for quick and dirties manipulating and testing Java classes, putting a dent into use of Groovy and Xtend in Java shops. After all, people who learn and work in Java will want to learn JavaScript for the same sort of reasons.

Re: The Birth and Death of JavaScript [video]

#44
post #33

> xs = ['10', '10', '10'] > xs.map(parseInt) [10, NaN, 2] Javascript is beautiful.

Just like with any language, as long as you read the docs of the stuff you use, you don't get this problem (you might get others with automatic type conversion and missing arguments like the speaker says, but not this )... this is just stupid. Try this: int subtract(int b, int a) { return a - b; } int test = subtract(5, 3); // != 2, just read the damn docs Oh, C sucks now ! The talk is quite fun and interesting to wa…

The thing is, good language design means you don't have to read the docs.

The number one thing taught at user interaction / usabillity courses is that users don't read the documentation. Or skim it and go directly to one or two parts they want to check (Sure, some bizarro outliers do read it all).

Besides, a golden rule from the UNIX era is the "principle of least surprise". Don't define stupid behavior as default, as in this case (both for parseInt and Map).

Re: The Birth and Death of JavaScript [video]

#45
post #29

Earlier quoted context omitted.

There are so many good WTFs in JS, but this is not one. parseInt expects 2 arguments and Array.prototype.map provides 3 to the callback it is given. Both of these facts are very well documented and known. var mappableParseInt = function(str){ return parseInt(str, 10); }; ['10', '10', '10'].map(mappableParseInt); I'd suspect this snippet is more a snipe at people who don't know JS very well and expect parseInt to be b…

You could say it's a snipe at the weak type system that Javascript has. I dunno, as someone without much experience with Javascript, it is a little odd that arrays return the index alongside the value by default.

arrays don't do that, but map() does. Normally in js you can just ignore arguments you don't care about, but it does lead to surprises like this one.

Re: The Birth and Death of JavaScript [video]

#46
post #43

For those unfamiliar, Gary Bernhardt is the same guy who did the famous "Wat" talk on JavaScript: https://www.destroyallsoftware.com/talks/wat

Classic video, though it's wrong at times. For instance, the audience member who corrected him was right.

couldn't quite make it out, what did he correct?

Re: The Birth and Death of JavaScript [video]

#47

> xs = ['10', '10', '10'] > xs.map(parseInt) [10, NaN, 2] Javascript is beautiful.

I just wrote this line about two hours ago and my tests weren't thorough enough to catch the bug it introduced. Just when I thought I knew JavaScript. Thanks for saving me some time.

Re: The Birth and Death of JavaScript [video]

#48
post #44
post #33

Earlier quoted context omitted.

Just like with any language, as long as you read the docs of the stuff you use, you don't get this problem (you might get others with automatic type conversion and missing arguments like the speaker says, but not this )... this is just stupid. Try this: int subtract(int b, int a) { return a - b; } int test = subtract(5, 3); // != 2, just read the damn docs Oh, C sucks now ! The talk is quite fun and interesting to wa…

The thing is, good language design means you don't have to read the docs. The number one thing taught at user interaction / usabillity courses is that users don't read the documentation. Or skim it and go directly to one or two parts they want to check (Sure, some bizarro outliers do read it all). Besides, a golden rule from the UNIX era is the "principle of least surprise". Don't define stupid behavior as default, a…

Both behaviors make sense in isolation. It's not always so easy.

Re: The Birth and Death of JavaScript [video]

#50

> xs = ['10', '10', '10'] > xs.map(parseInt) [10, NaN, 2] Javascript is beautiful.

I just wrote this line about two hours ago and my tests weren't thorough enough to catch the bug it introduced. Just when I thought I knew JavaScript. Thanks for saving me some time.

I'm sure you know this by now but you can keep the syntax and use Number instead

xs.parseInt(Number)

Post reply on HN