James Coglan <jcoglan@googlemail.com> writes:
[Note: parts of this message were removed to make it a legal post.]
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.
Ok, well, first impressions:
* It seems fairly large for what it appears to do. But I've not
investigated this in depth.
* There's no in-line documentation, which is a pain if you're
evaluating code.
* I'm quite certain using constructors as the basis for classes is
just wrong in javascript. I don't have the time now to go into this
in depth. I put some earlier explanations about constructors online
here:
http://joost.zeekat.nl/constructors-considered-mildly-confusing.html
At the moment I think that any code that's serious about building
classes in JS should start from something similar to Crockford's
"begetObject":
http://javascript.crockford.com/prototypal.html
and forget about constructors all together.
* I'm not certain that you should even try not to "deviate from
Ruby-like behaviour". You're not writing a ruby library, after all.
···
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/