After 3 (in words "three") days of hard work and 1500 lines of code, the new completely rewritten version of RubyJS is nearing completion. I have learned a lot from the old version, and that's why I took the approach to rewrite everything from scratch. It has paid out. The code now is much cleaner and it's so much easier to extend (add optimizations). The generated code is much more dense and should execute much faster! This is thanks to direct method calls, instead of going an indirection over a rubyjs_send method. In the old version of RubyJS this indirection was needed to make method_missing working, but now I took a better approach, which lets you generate code like obj.method() instead of rubyjs_send(obj, method).
There are still some things missing in the new version, but they are pretty straight forward to implement, especially as I've already implemented them in the old version. So it's mostly copy and paste and then modify a few bits.
What has changed as well was the method calling convention. In the old version I used:
function(self, args, block)
whereas I now use:
function(block, arg1, arg2)
I really think given another day of hard work, RubyJS is (mostly) feature complete and I can start working on doing something "real" with it. Last night (this morning :) I took a look at Google Web Toolkit, especially at the API and class hierarchy. While it's Java, they did it right! It's not unusual to see over-designed Java APIs, but this for sure is not one of them. Of course in Ruby it will be much easier as you don't need all those interfaces. Porting the widgets code and DOM to Ruby I assume will take me another 1-2 days. I will not port it line-by-line, I'll write my own code, just copying most of the API, which I don't want to reinvent.