Live data from Hacker News

The Birth and Death of JavaScript [video]

destroyallsoftware.com

131–140 of 236 posts

Re: The Birth and Death of JavaScript [video]

#132
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…

I don't think `parseInt` accepting an optional second argument is the surprising behavior there. The real WTF is `map` passing more than one argument, and the loose behavior of JS regarding argument passing overall.

It's only WTF because it's not the same as other implementations of map. Once you can internalize the map implementation, it's no longer WTF & actually makes sense.

Re: The Birth and Death of JavaScript [video]

#134

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

> Javascript is a bad choice

Javascript is great once used in a "good" way. It's flexible & it's almost everywhere. Spending all your time complaining about how "bad" Javascript is kindof pointless. If you use Javascript, learn how to use it well.

Master sushi chefs don't sit there complaining how bad knives are because the knives need to be constantly sharpened.

If you are cooking spaghetti, learn how to strain the noodles, instead of using silly examples assuming people are incompetent at learning a tool.

https://www.youtube.com/watch?v=rbA9KAc5gZs

Re: The Birth and Death of JavaScript [video]

#135
post #35
post #4

I'm missing some obvious joke...but why is he pronouncing it yava-script.

No hard 'J's in many languages (Like Slavic languages). It's pronounced 'y'. Anyone have a list?

The sound ʤ seems to occur in most Slavic languages [1], I guess the primary reason why "Java" is read as "Yava" is because people tend to apply local pronunciation rules to commonly used foreign words, either because of lack of knowledge of native pronunciation or because native pronunciation sounds just silly.

[1] http://en.wikipedia.org/wiki/Voiced_palato-alveolar_affricat...

Re: The Birth and Death of JavaScript [video]

#136

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

> Javascript is a bad choice Javascript is great once used in a "good" way. It's flexible & it's almost everywhere. Spending all your time complaining about how "bad" Javascript is kindof pointless. If you use Javascript, learn how to use it well. Master sushi chefs don't sit there complaining how bad knives are because the knives need to be constantly sharpened. If you are cooking spaghetti, learn how to strain the…

The fact that something is "almost everywhere" doesn't make it good. It makes it useful at most.

And your examples make sense, javascript doesn't (in some cases) so it's very appropriate to complain.

Re: The Birth and Death of JavaScript [video]

#137

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

> Javascript is a bad choice Javascript is great once used in a "good" way. It's flexible & it's almost everywhere. Spending all your time complaining about how "bad" Javascript is kindof pointless. If you use Javascript, learn how to use it well. Master sushi chefs don't sit there complaining how bad knives are because the knives need to be constantly sharpened. If you are cooking spaghetti, learn how to strain the…

With this logic you can defend anything. PHP's great if used in a good way: Zuckerman's a billionaire. Right? Why is anyone even bothering with PL these days?

Sushi knives don't decide to cut you because the rice came from a different origin. And I'd guess that most craftsmen, outside of a ritual and tradition would love for their tools to have less disadvantages.

If you want to draw an analogy to spaghetti (?), it'd be like complaining that the only kind of spaghetti you can buy locally cooks only at a specific temperature, and even a bit more turns it to mush. And the reason is because the local government passed a bylaw with only a few hours of consultation that ended up banning imports of better kinds of spaghetti.

While it might be "pointless" to spend all your time complaining, there's certainly value in asking "wat" and pointing out absurdity.

Re: The Birth and Death of JavaScript [video]

#138

Earlier quoted context omitted.

While security is the main answer, it was also that Java and Flash aren't necessarily available. That is, getting them to run on another machine was frequently a huge issue, especially if you tried to put in any kind of complexity. Javascript, on the other hand, was omnipresent and comparatively accessible. It was the least bad option by a wide, wide margin. For a different comparison, I switched from Java applets to…

Oh, yeah, especially after Microsoft stopped shipping Java. There was also the version issue to worry about. "Pardon me, Mr./Ms Customer/User -- would you mind terribly going and downloading and installing a 20 MB Java update on your 14.4k dialup connection before using this page?" Nightmarish, it was.

I always found it a bit hilarious how Sun, after getting Microsoft rather onboard the Java train, albeit with their necessary native extensions, decides to sue them and put an end to it. And promptly kills off Java distribution and adoption by the largest software developer in the world.

Even stranger is how Sun, a hardware/platform company, decided making a popular platform that's hardware and platform independent would help their business. Sometimes I wonder if there was a really well thought-out plan, or people were just doing things.

Re: The Birth and Death of JavaScript [video]

#139
post #29

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

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…

A bit less annoying with ES6:

  >>> ['10', '10', '10'].map(x => parseInt(x, 10))
  [10, 10, 10]
Post reply on HN