3 ms·
Yes, it's really that hard. When Chrome fixes "undefined is not a function" and ES6 arrives with lexical scoping and classes, Javascript will reach approximatel
by lmm 12y ago
Yes, it's really that hard. When Chrome fixes "undefined is not a function" and ES6 arrives with lexical scoping and classes, Javascript will reach approximately the functionality of Java 1.0 (plus lambdas, which sure, are a big flaw in Java 1.0) - only twenty years behind the state of the art for slow-moving large companies. I'm finding it hard to find the words to express how much better a real type system makes programming, but let's just say it would eliminate all the angst about callbacks and promises without breaking a sweat. Writing a big program in Javascript is like... it's like writing a novel in Up Goer Five style. Every time you think of something you have to stop and disassemble it into smaller pieces so that Javascript can talk about it. You copy-paste phrases that represent a word in your head, because the word in your head can't be represented in that language except as this four-word phrase that even then doesn't really capture what you're talking about. You write a paragraph and feel really proud of yourself, and then you realise that what you actually wanted to say was just a single sentence.
- xtrumanx 12y agoI'm not too knowledgeable about type systems but to me "undefined is not a function" is simply the by-product of a dynamic/weak type system. That complaint can be equally applied to ruby, python, etc. Can't I misspell a property or variable in such languages and get a similar error to "undefined is not a function"? Yet I don't see people complaining about them as much as JavaScript.
- lmm 12y agoNo, in Ruby/Python/etc. the error message at least tells you which property was misspelled/undefined. It's still bad (I would hate to have to use Ruby/Python for everything and would complain if they were the only languages the browser supported) but it's 10x better than Javascript.
- xtrumanx 12y agoOh, now I understand why that's error is such a big deal for people. I guess it never clicked for me since whenever I come across it I usually also have access to a stack trace or that line number which threw the error.
- bcg1 12y agoWoah! We're playing the Java 1.0 card??? Java is my language of choice most of the time so I'm not hating, but seriously, Java 1.0? I think you might be nitpicking... JavaScript is perfectly usable as is. They even ship a js interpreter with OpenJDK since 1.6... why bother if Java is so much better and easier to use? And also conflating a bug in Chrome with a language deficiency seems fallacious.
- lmm 12y ago> They even ship a js interpreter with OpenJDK since 1.6... why bother if Java is so much better and easier to use? Because > And also conflating a bug in Chrome with a language deficiency seems fallacious. It's not a Chrome bug, it's a missing feature in every existing Javascript implementation that only Chrome is bothering to add (though hopefully other implementers will follow suit shortly)
- lmm 12y agoFirst was meant to be: because there's real value in using the same language on the server and the client (if only for parts of the code), and on the client it has to be javascript. (Also because certain libraries, in particular for async, simply don't exist for Java because the sync version is "good enough")
- stevendwood 12y agoCertainly words like ListenableFuture<List<SomeResult>> fut = pool.submit(new Callable<List<SomeResult>>....are big that's for sure
- hyperpape 12y agoI program in Java and JavaScript on a daily basis, though neither one is my favorite language. Force me to choose, and I'll grit my teeth and take Java for the sake of static types. But Java today is not clearly ahead. High level languages should have either lightweight objects/dictionaries or tuples (my preference is for both, but you can get by with just one). Java lacks both to this day. And even "big flaw" is a pretty big understatement about the impact of higher order functions.
- tracker1 12y agoClasses are overrated. If you work from a more functional over oo mindset, you'll find that you really don't need them. Not to mention doing unit testing in JS doesn't require the mental spaghetti of interfaces or IoC/DI that it does in strongly typed languages. If you use a module/builder system in JS, you can do composition and testing that most other languages simply don't hold a candle to. Including Java/C# and plenty of others. If you include Browserify+BabelJS it gets better still. Just because you have trouble wrapping your head around the concept of modules or object composition without classes doesn't mean everyone lacks that skillset. /rant
- lmm 12y ago> Classes are overrated. If you work from a more functional over oo mindset, you'll find that you really don't need them. I do work in a functional mindset. I still find that I need them often, for cases where one case needs to be handled differently from others, which is a very common business requirement. Something like typeclass deriving can help, but javascript doesn't have that. > doing unit testing in JS doesn't require the mental spaghetti of interfaces or IoC/DI that it does in strongly typed languages. You don't have to do it that way if you don't want to - even in humble java it's trivial to mock any object or none if that's what you want. I like having explicit interfaces - they're what make it possible to maintain big codebases.
- deleted 12y ago[deleted]