Live data from Hacker News

My gripes with JavaScript

ironjs.wordpress.com

41–48 of 48 posts

Re: My gripes with JavaScript

#41
post #7
post #4

There seems to be agreement that Javascript is a messy language which is popular by default: it was included in Netscape, then other browsers picked it up. Now we're stuck with it. I realize this would be very difficult and introduce horrible compatibility issues for a while, but sometimes I think, "what if we could start over?" What if Chrome and Firefox started supporting Python or Ruby or a custom, well-designed l…

I would not consider that a dream team considering the languages/libraries they have produced.

You think jQuery, Ruby and Python are subpar?

Why, and who would you pick?

Re: My gripes with JavaScript

#42
post #35
post #29

Earlier quoted context omitted.

IMO, it accomplishes this not as much by being good, as by being a parasite that infects web browsers. At that, it is so good that some people think the DOM and JavaScript are in a symbiotic relationship. Yes, that is tongue-in-cheek, but without JavaScript, web browsers would have found another language; without web browsers, JavaScript would long have been forgotten.

> IMO, it accomplishes this not as much by being good, as by being a parasite that infects web browsers. My memory is a bit foggy, but I recall Microsoft throwing a bunch of things at the browser in the beginning. You can specify the language in the script tag. VBScript anyone? It wasn't like JavaScript didn't have competition ... it just won a very long time ago.

Microsoft threw one other language into Internet Explorer, and as far as I can recall didn't push it any harder than JavaScript. No other scripting language was ever implemented in any other browser. To call VBScript a competitor is being overly generous. JavaScript was really the only option for DHTML.

Re: My gripes with JavaScript

#43
post #10
post #6

Earlier quoted context omitted.

I'm well aware of js.next/harmony/whateveryouwannacallit. Come back to me in 10 years when it's implemented everywhere and everyone that was on an old version of browser X has upgraded to one with those features.

Or use a tool that compiles js.next to lowest-common-denominator-javascript.

http://code.google.com/p/traceur-compiler/

Re: My gripes with JavaScript

#44
post #8

Earlier quoted context omitted.

Some kind of flexible bytecode implemented across browsers would be fantastic, and you could always implement a fallback interpreter in javascript (or if feeling fancy, a decompiler).

Isn't Javascript a flexible bytecode?

JavaScript is a programming language that compiles to bytecode. It can be treated as object code, but it is a very different and higher-level thing than the term "bytecode" generally denotes.

Calling JavaScript "flexible bytecode" is like saying that all Turing-complete programming languages are the same, or that all objects capable of driving a nail into a piece of wood are equivalent. It's true in a very facile way. JavaScript can be treated kind of like bytecode, and all Turing-complete languages can be treated as a simulation of a Turing machine, but the details that these rough descriptions miss are more numerous and more significant than the details that actually went into forming the generalization.

Re: My gripes with JavaScript

#45
post #8

Earlier quoted context omitted.

Some kind of flexible bytecode implemented across browsers would be fantastic, and you could always implement a fallback interpreter in javascript (or if feeling fancy, a decompiler).

Isn't Javascript a flexible bytecode?

JavaScript is a programming language that compiles to bytecode. It can be treated as object code, but it is very different and higher-level thing than the term "bytecode" generally denotes.

Re: My gripes with JavaScript

#46
post #26
post #21

The other problem I would see is obvious if you continue with something like the following logic: All successful languages passed through a phase in which they had a broadly similar list of problems. How did they escape from that phase? Because somebody had the power to move the language forward. Somebody (or small set of somebodies) could say "yes" to that idea and "no" to the other idea, and implement them, and hav…

The fact that everything you said is true makes JavaScript an even more amazing language. How many languages could survive 15 years without change and still remain relevant? And not only relevant, but expand their influence? Certainly this is mostly due to its unique position on the browser, but the language had to be flexible enough to fill that role and more. That's amazing .

> How many languages could survive 15 years without change and still remain relevant? And not only relevant, but expand their influence?

I can think of one other, and for the same reason: make. Both languages are still around because it's near impossible to replace them, no matter how much they may suck. They aren't timeless, they're calcified by being a part of some infrastructure that exists on millions of machines.

Re: My gripes with JavaScript

#47

I'm sure you'll be happy to know that all your gripes are de-griped in js.next ( http://wiki.ecmascript.org/doku.php?id=harmony:harmony - and strawman) - and with the speed of browser upgrades they'll hopefully be here the "reasonably close" future. Hopefully.

"Hopefully" indeed -- I had a lot of hope for ECMAScript 4 back in 2007, and look how that turned out.

As with most "next gen" web browser technology (for whatever your 'current gen' may be, back to Netscape 2.0), until I see it actually shipping in a majority of browsers I will remain skeptical.

Re: My gripes with JavaScript

#48
post #30

Earlier quoted context omitted.

If we started over, we should pick a VM, not a language.

Producing a truly language-neutral VM would be an interesting goal, one that no-one's really got that close to achieving. (I think Microsoft's got closest.) Making it a compact wire format to boot would be... challenging. Ultimately, a VM is just another language with lousy readability.

I see your point, but I think a VM spec comes with an implicit promise that it is OK to develop languages as opposed to the "why don't you just program in what we give you?" mantra.

I agree its a very hard problem. If I was starting from scratch I would probably look a lot more on vector operations than someone would have 10 years ago. Plus the manner of parallelism a person choses would seriously influence language implementors.

Post reply on HN