[MacRuby-devel] super_foo style RubyCocoa messages.
Laurent Sansonetti
lsansonetti at apple.com
Tue May 6 11:02:16 PDT 2008
On May 6, 2008, at 10:10 AM, Pierce T. Wetter III wrote:
>>> It is, but I have to say that I always found the super_foo syntax
>>> confusing in RubyCocoa. That's probably because I came to Ruby
>>> from ObjC, not ObjC from Ruby... I kept wishing that:
>>>
>>> super.foo() would work. Is that possible?
>>
>> Hi Pierce,
>>
>> That syntax wouldn't work because calling "super" will call the
>> method you're in from the superclass.
>> AND it may/will return an object. In your example you are calling
>> #foo on the result object of the super call.
>>
>> But that would be the functionality I suggest yes.
>>
>> About the weird syntax in RubyCocoa, I agree.
>> But this wouldn't be a compatibility layer without supporting it's
>> intricacies now would it :)
>
> Hmmm... Given that this is something where Ruby/ObjC (or for that
> matter Java) butt heads, I wonder if there should be a better
> syntax? Like:
To clarify, we are not talking about introducing any new syntax or
"public" API in Ruby, but to introduce a way that the RubyCocoa
compatible layer can use to translate "super_foo" messages as a
"super" call. The way would most probably be private
(__send_super__ ?) and could be implemented as a C extension.
Before (RC):
def initWithName(name)
super_initWithName(name)
end
Now (MR):
def initWithName(name)
super # just works
end
Laurent
More information about the MacRuby-devel
mailing list