4 ms·
I have distastes towards some languages I've had limited exposure to. Pretty much, these are languages I had to use, but not languages I had to get good at usin
by nxn 16y ago
I have distastes towards some languages I've had limited exposure to. Pretty much, these are languages I had to use, but not languages I had to get good at using. Among these would be PHP, VB, and maybe Java (though I actually liked it before I started using C#).
Then, there is JavaScript, which I cannot avoid using despite having concerns with it. I would not say I "hate" it though, it's more of a "love and hate" relationship that formed over time here. I guess I look at it as being in a large city: if you know where to go it can be a wonderful time, if you don't you'll be shot in the face.
Among the things that bother me the most are function only scope, specifically when it mixes with declaration hoisting and implied globals. You can really end up writing some deceitful, innocent looking code that just does not do anything you'd expect it to. It's somewhat simple to avoid any problems that might come up if you're aware of them, but it's made me extra touchy; I get uneasy feelings when I see a variable declaration that is anywhere except the top of the function it is declared in. At the same time, having a large distance between the declaration of the variable and its use has been somewhat problematic for me: if I change the name of the variable, I must also remember to scroll up to change where it was declared, otherwise I just added a new global property. This bites.
The other significant issue I have is inheritance. I wouldn't mind if it actually resembled normal prototype based inheritance, but it just doesn't. It's too mixed up with the classical approach, making the end result neither simple nor powerful. It's easy to see that this problem in the language since there are so many different patterns of creating and extending objects as a result. Almost every framework/lib uses a different approach and tries to abstract it so the end user doesn't have to be aware of it. Of course, that only gets you so far before you end up having to look at how the libs you're using implemented it, and that sort of defeats the reason for the abstraction in my opinion. Something as fundamental as this shouldn't be so problematic, but it is.
Strangely, when I'm looking at EcmaScript 5 and Harmony, and see the changes that might try and fix these things, I kind of feel sad because it just wont be the same JavaScript I got used to fighting with.