Hacker News new | ask | show | jobs
by winteriscomming 5289 days ago
No real classes. No type systen (optional at least would be good). No packages. No modules. No generics. No annotations, mix-ins, actors. No properties. No interfaces. No abstract classes. Horrible to maintain on large projects. Horrible tooling. Bad performance compared to VM or Native code. So much more.
2 comments

Both the classes and type system are not inherently obvious: there are plenty of valid arguments for both prototype-based OO and dynamically typed languages. I personally like prototypes more than classes and am ambivalent about static/dynamic typing.

JavaScript does have packages and modules--check out CommonJS, for example. There are some issues with them in the browser, but that's a different story.

Generics and interfaces make no sense in a dynamically typed language. Abstract classes don't really make that much sense with a dynamic type system either, and they make no sense with prototype-based inheritance. Mix-ins don't make really fit into a prototype-based language either.

Properties would be nice. I don't know about tooling--js2 mode on Emacs is infinitely better than any IDE I've ever used (and I've use a bunch). I've never had issues managing JavaScript code--less issues than Java, for example--but I've never worked on anything particularly big.

JavaScript performance is now quite good. Besides, performance is not a function of the language but a function of the implementation. You wouldn't think of Scheme as a particularly fast language, but I remember recently reading about Stalin Scheme which made it as fast or faster than C.

Really, most of your arguments seem to stem from not liking prototypes and dynamic typing--these are just preferences. Complaints about JavaScript's lacking interfaces are like complaining your Tesla doesn't have a gearbox.

Your argument really makes it seem you would like nothing more than Java/C# in the browser; I personally would like little less than that. This is probably at least partly due to the name: JavaScript makes it seem like the language is akin to Java when it really only shares a superficial resemblance.

I'm not sure if you're a fan of Dart or not, but it has nine of those now (classes, types, modules, generics, actors, properties, interfaces, abstract classes, and tooling) and more on the way.

Might be worth giving it a try.

Yes I like the direction dart is going in (except would prefer the type system had more actual meaning than just annotations for tooling, but still).

My pipe dream: - Google implements a VM for dart or equivalent.

- Dart, Java, C#, ActionScript, Python, Ruby, whatever, can compile to this VM.

- VM/bytecode is initially just in chrome, which is fine as far as I am concerned (no problem saying our app works in chrome only). You can transpile to JS if you want to target other browsers.

- Because of native VM implementation in chrome, the best web applications are in chrome. Chrome increases in popularity.

- Other vendors are forced to implement this VM.

- We get to something like a client VM (lets call it CVM) standard for all browsers.

- Developer productivity improves and browser based apps start not sucking so bad in comparison to their native brothers.