Hacker News new | ask | show | jobs
by twistedpair 4419 days ago
Amen. I'd add that while JS is great for form validation, trying to make it into a first class language is a bit laughable. For example, if you want to define a function in a namespace, it's up to you which half dozen "patterns" you use to emulate namespaces in the language that lacks them. Same goes for private method/variables, continuations, classes... or more features of other common language. Add to that the type coercion cluster and the ability for attackers to redefine core language types (make 1 evaluate to false) and JS is still a bit of a anything goes wild west of a language (first class functions are fun).

FWIW, I've written a few 100KLoC of production JS code, but man, I'd really rather use Java/C#/PHP as everyone in JS land has to bend over backwards to try to have the features that are standard out of the box in other languages.

1 comments

> while JS is great for form validation, trying to make it into a first class language is a bit laughable FWIW, I've written a few 100KLoC of production JS code

Having written a few KLoC of js with angular.js and about the same in tests on it, it definitely is a first class language now ... for the browser. On the server, you have other better options with types, threads and the whole works.

Also, if you've actually written over 100KLoC of javascript, then either you work on high-end web apps for google and co, or you're coding badly wrong.

Various large enterprise one page apps mainly in ExtJs (i.e. 70KLoC per app), predating the many new Xjs libs. Admittedly, they are likely terser these days than a few years back. However, I like to stick to GWT now and write JS compiler plugins to get the JS I need. :)