I quite disagree: Javascript has a few warts, but it's quite elegant at its core, and very powerful.
Namespaces might be of use, but you can use objects to handle them easily enough; the variable scoping rules are only a problem if you don't understand closures (which are one of the things that gives JS such power), automatic semicolon placing...yeah, that sucks, so I don't rely on it. I always use semicolons.
The main thing I dislike about Javascript, the language, is the overloading of + to mean "addition" and "string concatenation". Operator overloading is never a good idea, especially in this case, because JS is dynamically typed, and numeric values may be misinterpreted as strings.
I think JS gets a bad rap because people are used to dealing with DOM incompatibilities, and blame those on the language.
Posted Aug 29, 2009 11:24 UTC (Sat) by lkcl (guest, #60496)
[Link]
"I quite disagree: Javascript has a few warts, but it's quite elegant at its core, and very powerful."
oo, absolutely! think about this: an implementation of python classes - dynamic multiple inheritance including superclasses and the (very rarely used and misunderstood _three_ arguments to the type() function: kls = type("ClassName", [Baseclass1, Baseclass2], {'method1': fn })...
... that can be implemented in UNDER 100 lines of javascript!
there's a little trick to do "object-like" inheritance which is typically deployed in javascript frameworks: it creates a new Object() and then sets up the prototypes copying them from the base object. that's typically implemented in about... 15 lines of javascript. all we did was expand that a little bit further.
voila. instant emulated multiple inheritance and python superclasses.
the warts: achhh. anonymous objects that don't carry around the "this" pointer properly. having to create a wrapper function which re-associates the .... never mind :)