[MacRuby-devel] super_foo style RubyCocoa messages.

Pierce T. Wetter III pierce at twinforces.com
Tue May 6 16:53:40 PDT 2008


>>>
>>
>> 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


   Yeah, I get that but what if you want the common ObjC idiom where  
you add a new
initializer and then call the super classes implementation of the old  
one?


    def initWithName(name)                   - initWithName: (NSString  
*) inName
                                             {
       self=super_init()                          id self = [super  
init];
       @name=name                                    name= inName;
       return self                                   return self;
    end                                      }

   super() isn't appropriate in this case. I don't like super_init()  
there. I think its ugly syntax, and its less clear then:

   super.init()

  would be, or even:

   superclass.init().

   or _super.init()

  Pierce

  
  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1590 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/macruby-devel/attachments/20080506/d6126713/smime.bin


More information about the MacRuby-devel mailing list