by lmm · 11y ago · 0 comments
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.
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)
(Also because certain libraries, in particular for async, simply don't exist for Java because the sync version is "good enough")
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.
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.
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
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.