Or maybe we could just not mangle Initialize CLR method name. That would 
prevent the conflict in most cases (.NET guidelines recommend to use Pascal 
case method names).

Tomas

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Curt Hagenlocher
Sent: Sunday, September 07, 2008 1:19 PM
To: [email protected]
Subject: Re: [Ironruby-core] Deriving from framework class with Initialize 
method

Interesting.  What do you think should happen when a CLS type has a method 
whose name collides with a "special" Ruby method name like "initialize" or 
"allocate"?  This isn't an issue in IronPython because of Guido's foresight in 
decorating all special names with double underscores. :) Maybe for IronRuby, we 
could decorate certain CLS-imported names with a trailing underscore to avoid 
this kind of problem.

Out of curiosity, what does JRuby do in this case?

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Dobrev
Sent: Sunday, September 07, 2008 12:11 PM
To: [email protected]
Subject: [Ironruby-core] Deriving from framework class with Initialize method

Hi guys,

I was trying to run the following code:

class MyObj < DependencyObject
end

obj = MyObj.new

Where DepenencyObject comes from the WPF stack (WindowsBase.dll). However this 
fails on the MyObj.new line with strange error that wrong arguments or types 
are passed to initialize method. After some digging I found that 
DependencyObject have a private method Initialize which makes the problem. 
Rewriting the code like this makes it work:

class MyObj < DependencyObject
  def initialize
  end
end

May be method resolution somehow get messed up.
Sample file attached.

Regards,
Stefan
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to