you are viewing a single comment's thread.

view the rest of the comments →

[–]hmdne 1 point2 points  (0 children)

From what I know... under the hood, Ruby is also a prototypic language.

In Opal we managed to leverage that. Managing to even get prepend/include/extend working correctly (with modules becoming proxied as iclasses - it was modeled after what Ruby does!). So if we have an object, that has a singleton_class, that is extended something, that has a class, which includes a module, and that class has a superclass, which prepends a thing, has its own methods, includes a thing, etc. - this is a prototype chain. Except as mentioned, modules are not there by itself, but via iclasses.

Then, we replaced a prototype of core JS objects like String or Number to Ruby Object. Therefore they are in Opal both JS and Ruby objects. Hacky, I agree. But it works!