Hi all, I have a pull request in on RSpec ( https://github.com/rspec/rspec-expectations/pull/160) to fix an issue I encountered with MacRuby, but I'm hoping someone here can provide a better explanation of the root cause of the issue than I can. Basically RSpec was assuming that a version of Ruby that defined BasicObject would have all objects inherit from BasicObject, which is the case in MRI 1.9.2. In MacRuby, however, BasicObject exists in a weird sort of parallel universe; it has no ancestors, yet nothing seems to inherit from it either. You can see my attempt at explanation in the pull request; can anyone provide a better explanation for this setup? Thanks, -Gabriel
Hi Gabriel, MacRuby's classes implementation is based on Objective-C. Ruby's Object class is alias of Objective-C's NSObject. So, Ruby classes/methods and objects are Objective-C classes, methods and objects respectively. The converse is also true. Objective-C and MacRuby APIs can be interchangeable at no additional performance expense. NSObject is root class in Objective-C. NSObject doesn't have an ancestor. However, CRuby's Object class has BasicObject as ancestor since CRuby1.9. I think Objective-C classes does not have a class like Ruby's BasicClass. And, Apple can only change the NSObject ancestor. So, MacRuby's Object/BasicObject relationship is different from CRuby. Thanks 2012/7/25 Gabriel Gilder <gabriel.gilder@gmail.com>:
Hi all,
I have a pull request in on RSpec (https://github.com/rspec/rspec-expectations/pull/160) to fix an issue I encountered with MacRuby, but I'm hoping someone here can provide a better explanation of the root cause of the issue than I can. Basically RSpec was assuming that a version of Ruby that defined BasicObject would have all objects inherit from BasicObject, which is the case in MRI 1.9.2. In MacRuby, however, BasicObject exists in a weird sort of parallel universe; it has no ancestors, yet nothing seems to inherit from it either.
You can see my attempt at explanation in the pull request; can anyone provide a better explanation for this setup?
Thanks, -Gabriel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/macruby-devel
participants (2)
-
Gabriel Gilder
-
Watson