[MacRuby-devel] Objective-C class +initialize in MacRuby

Caio Chassot lists at caiochassot.com
Sun Oct 10 11:33:25 PDT 2010


On 2010-10-10, at 15:15 , Matt Aimonetti wrote:
> 
> The problem in your example is that in Ruby, the constructor is an instance
> method, not a class method.
> So your mistake was to define self.initialize instead of just initialize.

I'm afraid you misunderstood my question.

I'm not talking about -init / #initialize.

I'm talking about the crazy special +initialize method that Objective-C calls when it first loads a class.

You can read about all its idiosyncrasies here:

  http://mikeash.com/pyblog/friday-qa-2009-05-22-objective-c-class-loading-and-initialization.html

Its lazy nature is what irks me. Code right in the class body in ruby seems to be more in line with Objective-C's +load.



More information about the MacRuby-devel mailing list