Live data from Hacker News

Is JavaScript getting worse?

buzzdecafe.github.io

21–30 of 117 posts

Re: Is JavaScript getting worse?

#21
post #3

I'm sorry, but I really see no point in this article. Do you realize that if the optional arguments were not included in Function#length, you'd just be saying "They are not reflected in the function’s length property. C'mon, man" instead ? Also, I don't understand Whoop-dee-freakin’-doo.

"They are not reflected in the function’s length property" is exactly what the article does say. Whoop-dee-freakin’-doo http://en.wiktionary.org/wiki/whoop-de-doo http://en.wikipedia.org/wiki/Tmesis

My bad, I misread. However, my point is still the same: there was two equally valid choices. Should the other path had been prefered, the author would now be complaining about it too. I don't find it very constructive.

As for Whoop-dee-freakin’-doo, no, it don't think it means anything in the context. That's not an argument, and the following sentence isn't either. Maybe I don't understand because english isn't my native language, tho.

Re: Is JavaScript getting worse?

#22

Earlier quoted context omitted.

Well that's perfectly normal in a properly scoped language.

What you have to keep in mind is that JavaScript is not "a properly scoped language". Pretending that it is will cause you to miss key aspects of how the tool works. This helps no one, including you. Please, for as crappy as the language might feel, approach the language on its own terms.

Function scopes and variable hoisting was not the best parts of JS anyway. let brings lexical scope into the game, which I think is a great progress. And you cannot expect a variable to be defined outside of its lexical scope. That's not any different that trying to access a variable outside of a function that is defined in.

If people were abusing variable hoisting in some way, they can continue to do so, by not using `let`.

Re: Is JavaScript getting worse?

#23

> This means that typeof can now throw >>> def f(): ... type(x) ... x = 10 ... >>> f() Traceback (most recent call last): File " ", line 1, in File " ", line 2, in f UnboundLocalError: local variable 'x' referenced before assignment irb(main):010:0> def f() irb(main):011:1> x.class irb(main):012:1> x = 10 irb(main):013:1> end => nil irb(main):014:0> f() NameError: undefined local variable or method `x' for main:Objec…

`typeof a` right now returns the string value "undefined" (assuming `a` was not defined anywhere)

If it can either return "undefined" or throw an exception, can you see why that would be a problem?

Re: Is JavaScript getting worse?

#26

> This means that typeof can now throw >>> def f(): ... type(x) ... x = 10 ... >>> f() Traceback (most recent call last): File " ", line 1, in File " ", line 2, in f UnboundLocalError: local variable 'x' referenced before assignment irb(main):010:0> def f() irb(main):011:1> x.class irb(main):012:1> x = 10 irb(main):013:1> end => nil irb(main):014:0> f() NameError: undefined local variable or method `x' for main:Objec…

Except, now you have one that you expect and the other you don't. This doesn't make the language anything but more inconsistent. I prefer consistency inside a language far more than familiarity between languages.

Re: Is JavaScript getting worse?

#27
> let considered harmful

Did people actually use the side-effect var-hoisting intentionally within their code?

Pretty much any JS style-guide worth its salt suggests manually moving var declarations to the top of scope since it's nice to know ahead-of-time which indicators of state you should be keeping an eye on.

The idea of inspecting a variable that is later-on defined with let seems baffling to me. I can't think of any reason why you would want to do this.

Re: Is JavaScript getting worse?

#28
post #24

Whats his problem with classes? I find them a whole lot easier to reason about than prototype based inheritance. (But then I have more experience with class based languages).

I imagine it has something to do with the 'new' functional movement that is gaining mind-share outside of academia.

Re: Is JavaScript getting worse?

#29
post #14
post #10

I don't understand the benefit of fat arrow. I actually think it decreases the readability. What does lexical "this" binding mean?

Fat arrow notation massively increases readibility by reducing the boilerplate verbosity of function definitions. Lexical "this" binding means that the "this" of the enclosing scope is reused; Arrow-defined functions do not get their own "this" when they are called.

Thanks but massively? function() {} vs () => {}?

Re: Is JavaScript getting worse?

#30
post #9

Betteridge's law[1] strikes again. [1] http://en.wikipedia.org/wiki/Betteridge%27s_law_of_headlines

That just gave you up as someone who didn't follow the link.

To be fair, the article itself ends with "No"

> So is Javascript getting worse? Well … no.

Post reply on HN