From: Tony Arcieri Date: 2009-09-07T06:28:30+09:00 Subject: Re: Rubyscript instead of javascript --001636ed67f3ce14860472ef694d Content-Type: text/plain; charset=ISO-8859-1 On Sat, Sep 5, 2009 at 6:58 PM, David Masover wrote: > Really? I tend to find the opposite. > > That is, most people who know a little Javascript and a lot of some other > language hate Javascript. > As someone who works with JavaScript on a daily basis, programming in it some and working with tools to support it the rest of the time, I really loathe JavaScript. JavaScript tries to force everything into a universal abstraction (the object) and yet that universal abstraction doesn't even work consistently. Take, for example: [].prototype *gasp* It's undefined! How can we check if something is an array? I suppose this works, albeit painfully so: [].constructor.toString().indexOf("Array") != -1 The typical retort I hear from those who like JavaScript is that if you ever need to do ^^^ you're writing your program wrong, however I'd just like to add a bit of polymorphism and it seems like it requires a huge hack. Also rather unintuitive and nonsensical is the behavior of the coercing == operator. For example: NaN == NaN ...is false! We lack basic reflexivity. Even worse: if([]) { ... } ...is true, in a boolean context [] gets coerced into a true value, however... if([] == false) { ... } ...is also true! When coerced by the == comparison operator [] gets coerced an entirely different way. I'm not sure how JavaScript wound up being so painfully inconsistent. -- Tony Arcieri Medioh/Nagravision --001636ed67f3ce14860472ef694d--