From: Michael Neumann Date: 2008-08-20T17:29:14+09:00 Subject: Re: [ANN] JS.Class 2.0 James Coglan wrote: > Hello list, > Do please forgive me if this is a little too off-topic but I thought some > folks here might be interested. I recently released version 2.0 of JS.Class, > my JavaScript library that implements some of Ruby's OOP features in > JavaScript. It is not a Ruby interpreter; rather it brings various idioms > found in Ruby OO programs to JavaScript, allowing for classes, modules, > inheritance, metaprogramming hooks, and ports of a few classes in the Ruby > stdlib amongst other things. > > If there's anybody here who's into JavaScript I would be thrilled if they > would give it a try and let me know about any weak spots where it might > deviate from Ruby-like behaviour. This release is the closest to Ruby I've > managed to get so far, and I'd love some help from the Ruby community to > iron out any obscure use cases. > > Anyway, without further ado: > http://jsclass.jcoglan.com/ > > Any help/feedback very welcome indeed. That looks pretty complete and well documented. I am mostly interested in how you implemented Ruby's meta model (classes, modules and meta-classes), as that's the hardest part at all. Mainly the circular dependency between Class and Object (a Class in Ruby inherits from Object, and Object is an instance of Class and as such an instance of itself :). Note that I wrote RubyJS [1] which is a Ruby to Javascript compiler. It supports all Ruby constructs (including method_missing) with the only limitation being that classes and methods are fixed at compile time, but you can use meta-programming in the pre-compilation stage (most of the time you will not notice the difference!). Regards, Michael [1]: http://www.ntecs.de/projects/rubyjs