[MacRuby-devel] BasicObject

Watson watson1978 at gmail.com
Wed Jul 25 02:46:25 PDT 2012


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 at 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 at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/macruby-devel
>


More information about the MacRuby-devel mailing list