News for hackers. Stuff that matters.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by alexwebb2 on Monday September 12, 2016 @03:10PM (#12482709)
I can't believe this is the top comment. Let's go point by point:

1) JavaScript has its warts and its gotchas like anything else (okay, maybe a few more). So what? Spend 50 hours building anything substantial with JavaScript and you'll get a good handle on them, and you'll be good to go for the next 10,000 hours. Same goes for just about any other language. Focusing on the weird edge cases might make for a nice blog post, but it's not relevant to people actually building things day to day.

2) Growing pains in a very active community? Unheard of! Okay, so this was embarrassing and disappointing, but at least it's been dealt with. You can keep pointing to it if it helps your argument, but that doesn't make it valid.

3) I don't really understand what point you're trying to make here.

4) Again, very active community. Lots of churn. Plenty of reinventing / rediscovering the wheel. If that _really_ bothers you and you're struggling to separate the signal from the noise, I at least understand and respect that criticism. I don't think that's a reason for anyone to stoop to the level you have, though.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by zeveb on Monday September 12, 2016 @03:55PM (#12483115)
> Spend 50 hours building anything substantial with JavaScript and you'll get a good handle on them, and you'll be good to go for the next 10,000 hours.

Spending 10,000 hours building things with JavaScript sounds like a pretty good definition of Hell.

JavaScript is an actively, abusively bad language. It's not that it has a few warts: it's nothing but warts. Its fundamental design flaws are obscured only by its superficial design flaws.

It's a really bad, tasteless language.

> I don't think that's a reason for anyone to stoop to the level you have, though.

I really don't think he 'stooped' to anything.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by seagreen on Monday September 12, 2016 @04:06PM (#12483191)
In case Eich reads your comment: given that it had to be done in ten days and "look like Java", JavaScript is a fine langauge.

(But yeah, compared to languages that were designed over years obviously it's incredibly bad.)

To quote Eich (from here[1]):

" Ten days to implement the lexer, parser, bytecode emitter (which I folded into the parser; required some code buffering to reorder things like the for(;;) loop head parts and body), interpreter, built-in classes, and decompiler. I had help only for jsdate.c, from Ken Smith of Netscape (who, per our over-optimistic agreement, cloned java.util.Date -- Y2K bugs and all! Gosling...).

Sorry, not enough time for me to analyze tail position (using an attribute grammar approach: http://wiki.ecmascript.org/doku.php?id=strawman:proper_tail_...). Ten days without much sleep to build JS from scratch, "make it look like Java" (I made it look like C), and smuggle in its saving graces: first class functions (closures came later but were part of the plan), Self-ish prototypes (one per instance, not many as in Self).

I'll do better in the next life. "

[1] Edit: jwz.org intercepts HN links. See mjgoeke's comment.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by mjgoeke on Monday September 12, 2016 @04:19PM (#12483281)
I'd recommend copy+pasting the link to www.jwz.org if you want to open it...

  https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/#comment-1048
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by roboguy12 on Monday September 12, 2016 @04:14PM (#12483254)
> The ecosystem is terrible and the community is full of self-righteous assholes who has the collective attention span of a 2 year old

> I don't think he 'stooped' to anything

Really? This is supposed to be a place for civil, mature discussion. There are plenty of valid arguments against javascript as a language and as a community, there's no need for childish comments like that.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by threatofrain on Monday September 12, 2016 @04:40PM (#12483449)
I don't understand why people say javascript is such an awful language. The "Wat" video previously posted features of a few javascript idiosyncrasies, but I think most people would consider such obscure syntax combinations to be ill mannered, and most people understand to be very careful around type conversions.

At a higher level of organization, the language begins to matter less and less, and what matters more are that subcomponents within a larger system obey their contracts, and that there's some concurrency strategy if you have distributed state.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by cygx on Monday September 12, 2016 @06:27PM (#12484189)
I don't understand why people say javascript is such an awful language.

Frankly, because from a language design perspective, it is - or at least used to be: Bad scoping rules (implicit global declarations by default, function instead of lexical block scope if var is present), weird implicit conversions, no good story for code reuse/object extension so everyone doing anything complex had to cook up their own version, ...

Nevertheless, I actually enjoy programming in Javascript ;)

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by freyr on Monday September 12, 2016 @05:53PM (#12484012)
> It's a really bad, tasteless language.

It's really not that bad. It's actually a good language, and getting better all the time. See? We can go back and forth, without any substance.

But seriously, modern JS is not that bad.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by amorphid on Monday September 12, 2016 @03:23PM (#12482824)
>> Spend 50 hours building anything substantial with JavaScript and you'll get a good handle on...

I don't mind MY JavaScript. It's everyone else's that drives me bonkers. Tracking down things in JS is a timesuck of epic proportions. Much of the time, it just isnt't any fun.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by axlee on Monday September 12, 2016 @03:33PM (#12482902)
> I don't mind MY JavaScript. It's everyone else's that drives me bonkers. Tracking down things in JS is a timesuck of epic proportions. Much of the time, it just isnt't any fun.

You should look into typescript, it has helped us quite a lot with that particular matter.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by yid on Monday September 12, 2016 @04:24PM (#12483313)
> Tracking down things in JS is a timesuck of epic proportions.

I think you mean your codebase rather than JS. There are plenty of industrial JS codebases where this is not a problem.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by amorphid on Monday September 12, 2016 @04:38PM (#12483427)
I'll be the first to confess I'm not a JS wizard. That being said, it'd be nice for the following to be easier:

* figuring out which events are listening to a given DOM element at any given time

* sane debugging for things Facebook Coonnect, which had a really confusing implementation at my last company

* no magically defined functions or variables (i.e. foo["bar"+ someId] = eval("function () {...}")

* keeping CSS out of JS, and JS out of HTML

* dealing with features tightly coupled to an ancient jQuery plug-in

I could go on forever... JS isn't necessarily that bad, but the way people use it is often suboptimal.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by yid on Monday September 12, 2016 @05:00PM (#12483641)
Not to be too pedantic, but most of those things have nothing to do with JS.

> figuring out which events are listening to a given DOM element at any given time

This is part of the DOM Specification, not JS. You may be using JS to manipulate and listen to the DOM, but the reason that browsers don't support doing thing X natively is because the DOM Specification does not specify it.

> * sane debugging for things Facebook Coonnect, which had a really confusing implementation at my last company

Again, this is about a Facebook client library, not Javascript.

> * no magically defined functions or variables (i.e. foo["bar"+ someId] = eval("function () {...}")

If you mean the use of eval to change the runtime environment, pretty much every dynamic language supports some form of eval. It would also be impossible to write certain types of code without eval.

> * keeping CSS out of JS, and JS out of HTML

Not sure how this is a criticism of JS.

> * dealing with features tightly coupled to an ancient jQuery plug-in

Again, this is a common software engineering problem, and has nothing to do with Javascript.

I think you've illustrated some of the reasons that Javascript is so apparently unpopular -- often (but not always) people reference some aspect of the DOM, or jQuery, or whatever vendor-hacked snippets from the late 90s that they remember, without considering that the "bad" parts of the language are by now well known, and there exist extremely efficient and standards-compliant, double-JIT'ed runtimes for JS.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by gaius on Monday September 12, 2016 @03:43PM (#12483000)
You are forgetting that even Eich didn't want to do JS; he wanted to embed Scheme but was overruled by suits at Netscape who wanted to ride the Java hype. That's why the semicolons and curly braces. It really is indefensible on technical grounds.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by goatlover on Monday September 12, 2016 @03:50PM (#12483062)
I think they also told him to make it forgiving, like html, so that beginners could use it. Thus the implicit conversion rules, optional semicolons, being able to leave new off a function constructor, not having to use var, and so forth.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by douche on Monday September 12, 2016 @04:54PM (#12483583)
It's too bad nobody pumped the brakes after it was a little successful, and said "Okay guys, let's stop dicking around and do this right now, before we have to deal with it for the next 30 years". Alas...
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by qwer on Monday September 12, 2016 @04:29PM (#12483347)
These laundry lists of js warts get dragged out continually, so I really have to ask: How are you people actually developing in javascript and haven't yet discovered linters?

Linters have been around for over a decade and solve all of these issues (as they do in other languages as well). They're also easily integrated in every text editor and build system I've ever seen.

And why shouldn't the interpreter support these rules? Because a linter can do this almost as easily, and not break backward compatibility.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by goatlover on Monday September 12, 2016 @06:47PM (#12484303)
The same can be said for C's flaws. Just use a linter.

That didn't stop people from wanting to come up with or use different languages in place of C, where possible.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by flukus on Wednesday September 14, 2016 @04:05AM (#12494908)
What state was guile in at the time? Could we have ended up with that instead of javascript?
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by behnamoh on Monday September 12, 2016 @03:36PM (#12482934)
If only web developers would unite and put an end to JS once and for all.

This is really sad, a whole industry that was once inspired by Unix philosophy and was supposed to be beautiful and fun, is now conquered by languages like JS, php, and Java: so ugly and so not fun.

I always thought programming should be something you do cause you like it, not because you're forced to do it. If you use JS cause "everybody else uses it" and "it pays more", then I'm sorry, you're screwed. I thought CS industry belongs to developers, not tech giants (Oracle, Microsoft, ...) who force Java and JS on everybody.

Someday, some body will stand up and say "Enough is Enough".

Edit: If you want to downvote, at least please tell me why I'm wrong...

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by serge2k on Monday September 12, 2016 @03:58PM (#12483137)
> (Oracle, Microsoft, ...) who force Java and JS on everybody.

Why call out Microsoft? They aren't forcing Java or JS. They came up with C# and Typescript instead.

I can't speak to Typescript, but C# is way more fun to write than Java. It's not particularly interesting or glamorous, but it is nicer to write.

Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by lloyd-christmas on Monday September 12, 2016 @05:04PM (#12483669)
We've converted all our JS to TS, huge timesaver.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by behnamoh on Monday September 12, 2016 @04:21PM (#12483297)
I meant in general. Microsoft did force their flawed Windows on everybody anyway.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De... by dpark on Monday September 12, 2016 @08:11PM (#12484776)
Microsoft forced Windows on everyone, therefore by the transitive property of online griping, Microsoft also forced JS and Java on everyone? But in general, so it makes sense.

This is like saying Coca-Cola is responsible for the high sugar content in Hershey's chocolate. In general.

Disclosure: Microsoft employee.