From: David Masover Date: 2010-07-18T12:41:55+09:00 Subject: Re: client-side Ruby on iPad/iPhone? On Saturday, July 17, 2010 11:43:52 am Tony Arcieri wrote: > On Sat, Jul 17, 2010 at 12:46 AM, David Masover wrote: > > Do you really know JavaScript well enough to hate it? It's possible > > you're an > > exception, but most people who hate JavaScript don't seem to know it > > particularly well. > > That's a pretty pretentious question to ask. But I'll bite. I was never asserting that it was impossible for someone to know JavaScript well and to hate it for that. But I do want to make sure it's an actual, legitimate concern -- often, I see people trying to avoid JavaScript because they like Object-Oriented Programming, for example. > Am I a JavaScript expert? But I know it fairly well. I could sit here and > prattle off a couple dozen things I hate about JavaScript, like the > practically broken coersion model, the inconsistent and likewise broken > core types, including inexplicable and useless box objects for those types > and mismatches between the literals and what core types they map to ([] > instanceof Array is true but "" instanceof String is false???), Those are all pretty weird, though I could mention similar oddities in Ruby, like the use of === in case statements, the concept of single inheritance but multiple mixins (but they behave like inheritance anyway), the ugliness of trying to pass multiple blocks as arguments, hashes as keyword arguments... And that's not even getting to my personal pet peeves, like many C methods calling other C methods directly (so I can't override them -- for example, Kernel#autoload calls the C implementation of Kernel#require directly, not the actual Kernel#require that might be there), the fact that I can't bind a method to an object that isn't related to it (so much for duck typing)... Every language has its warts. But I love Ruby, mostly because of how little these things actually matter to most of what I actually want to do. I can't say I've ever been bitten by JavaScript's coercion model or by its odd comparisons, though it is especially perverse that in Javascript, you can have this: [] != [] Explosion principle for the lose. Still, it's fair to hate a language for reasons like that. It's not fair to hate a language because of outright wrong assumptions -- again, most (no all) people I talk to who hate JavaScript hate it for the wrong reasons. > the need > for a JQuery jock strap to even make the language tolerable by masking > away all the bizarre gymnastics you'd otherwise have to do to get basic > functionality out of the language, etc etc. In other words, Ruby has a better standard library. So what? I could just as easily claim that Ruby needs a "Rack jock strap" before it's a useful Web development language. It also seems especially bizarre to mention jQuery here, when jQuery does nothing to make the language itself more or less tolerable -- it wraps itself around the DOM, though it comes with a few easily-duplicated utility functions. Are you complaining about JavaScript, or the DOM? > But like... this is ruby-talk, While that's true, I do try to offer general solutions, whether or not they involve Ruby. I also try -- and I've been accused more than once of being rude and pretentious for doing so -- but I try to find out what the actual problem is that someone's trying to solve and provide a solution to that problem, rather than to the specific question they asked. > and the guy wants to use Ruby instead of > JavaScript. I think you'll be extremely hard pressed to find anyone with > moderate level expertise in both languages who would disagree that Ruby is > a significantly better language than JavaScript. It depends what your goals are -- and you have to set some sort of goal before you can define a language to be "better" than another. I like Ruby. I'm certainly not going to start using v8 on the server side anytime soon. I'll run JRuby on Appengine to avoid writing Java or Python -- but I won't run JRuby applets on the client to avoid writing Javascript.