I’ve been writing JS since the time you’d pair a Webmonkey “DHTML” hack with some shit from Matt’s Script Archive and call it a day.
I created the Wikipedia entry on MochiKit 9 years ago.
onclick handlers and trying to force it into the Java object model.
I saw the jQuery vs. Prototype wars.
So I get it. Really.
And I’ve also heard this a few dozen times:
Referring to its not-totally-braindead object model.
And I’m still not happy. And I’d like to rephrase the above, in a way which I feel captures the language more accurately:
I woke up one morning last week with dread. I had a lot of front-end work to do.
That’s not how my back-end days start. There has to be something better.
I’ve played with a few of the “Ruby in JS” toys a several years ago. Surely, they’re all dead by now, or I’d read about them. There’d be Rubyconf videos and Railscasts (RIP). Somebody would be talking about it.
So I went searching and re-discovered Opal. Opal is amazing.
It has an in-browser demo much like CoffeeScript’s.
I started with
extend. OK, that works.
User inheriting from something? Broke. But it’s a bug in the site, not the Ruby implementation.
What’s surprising is how much Ruby works. The list of caveats are are small, well-documented, and make perfect sense. Symbols are strings. Regexps are JS flavor.
Opal tries to implement 1.9, with small parts of 2.0 and 2.1 thrown in, currently. But you’re still able to write Ruby, and have it feel like real Ruby.
I consider this to be the biggest risk I’ve taken on my current project, as it’s pretty far from the pack. Then I wrote my first client-side model, and woke up feeling great on my next frontend day.