Live data from Hacker News

Is JavaScript getting worse?

buzzdecafe.github.io

41–50 of 117 posts

Re: Is JavaScript getting worse?

#41
post #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.

[deleted]

Re: Is JavaScript getting worse?

#44
post #32

Earlier quoted context omitted.

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 usin…

If I'm following the blog post correctly, let does have effects outside of its lexical scope: it effectively makes the variable even more undefined than a totally non-existent variable . That is, the following code will not throw anything: // x has not been defined or initialized anywhere console.log(typeof x) However, if you add a let statement after it like so: // x has not been defined or initialized here console.…

I understand, but I believe this still happens only within the lexical scope where the variable has been defined with let.

TBH, It doesn't bother me at all. I think I can even go ahead and say the latter makes much more sense. Using the former one is abusing the weaknesses of the language that has come along with it throughout its history.

We have been whining about the bad parts of JavaScript for a long, long time and I think these changes are for the better for all of us.

Re: Is JavaScript getting worse?

#45
post #32

Earlier quoted context omitted.

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 usin…

If I'm following the blog post correctly, let does have effects outside of its lexical scope: it effectively makes the variable even more undefined than a totally non-existent variable . That is, the following code will not throw anything: // x has not been defined or initialized anywhere console.log(typeof x) However, if you add a let statement after it like so: // x has not been defined or initialized here console.…

It's not having an effect outside of its lexical scope. You introduce the let into the same lexical scope as the console.log.

It will also throw an exception every single time. So unless you're adding a variable, and then never testing the code path that hits the new line, you're probably going to catch it pretty early.

Re: Is JavaScript getting worse?

#47
post #21

Earlier quoted context omitted.

"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 na…

As a native speaker (granted, it's an American English idiom and I'm British), I understood it semantically as "so what?", i.e. "I don't care about this feature's existence".

Re: Is JavaScript getting worse?

#48
JavaScript is definitely getting better. The only question is whether they are changing too much too fast. There'll be a lot of headscratchers when running into unfamiliar ES6 code.

Re: Is JavaScript getting worse?

#49
post #34

Earlier quoted context omitted.

I think he means OO adds unnecessary complexity, hence the "bad bet".

ugh, really sick of this meme. OO is a tool in the box, it's useful a lot of the time, sometimes it isn't. The reason ES6 introduces the `class` keyword is that people are doing that already .

I somewhat agree, but "adding tools" at the language level doesn't come for free: it causes an explosion in the number of interactions to keep track of. How do classes interact with prototypes? How do they interact with lexical scope? How do they interact with exceptions? etc.

The egregious part is that, by turning something into a language feature, those who don't use it are often forced to take it into account in their code; especially library authors.

Re: Is JavaScript getting worse?

#50

Whoop-dee-freakin’-doo??? Sure there's a zillion frameworks and patterns for shoehorning OO into JavaScript. But the point is, ES6, is standardising it. That means libraries going forward will assume this is the way it's done and build on top of it. It gives them more expressive power and better inter-op. Also, default params are long overdue but I'm not sure that makes them "so what". I'd rather avoid mangling the a…

How exactly can OO be "shoehorned" into a language which is already OO?
Post reply on HN