Hi, On the Names page in IronRuby.net: http://www.ironruby.net/Documentation/.NET/Names I think there is a mistake. Bullet #4 says you must implement virtual methods with their rubyesque name. I tried using the CLR name and it seems to work great as well. FYI, Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/.
However, it is right when overriding CLR static methods. Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/.
Can you give an example? I''m not sure what do you mean by "overriding" static methods. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman Sent: Friday, June 12, 2009 11:16 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Error on Names documentation page However, it is right when overriding CLR static methods. Shay. ---------------------------- Shay Friedman http://www.ironshay.com Follow me: http://twitter.com/ironshay -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Sure.
C#:
public class Something
{
  public static Create()
  {
    Console.WriteLine("Creating Something");
    return new Something();
  }
  public Something()
  {
  }
}
IR:
class SomeSomething < Something
  def self.create
    puts "Creating SomeSomething!"
    super
  end
end
SomeSomething.create
# prints "Creating SomeSomething!
#         Creating Something"
If the IR method was named self.Create (with a capital C), the next will 
happen:
SomeSomething.create
# prints "Creating Something"
Thanks,
Shay.
----------------------------
Shay Friedman
http://www.ironshay.com
Follow me: http://twitter.com/ironshay
-- 
Posted via http://www.ruby-forum.com/.
I see what you mean. I wouldn''t call this "overriding"
because these two methods are completely unrelated. So it''s like you
defined two Ruby methods Create and create.
On the other hand, when a virtual method is overridden the override is bound to
the virtual one.
Tomas
-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Shay Friedman
Sent: Saturday, June 13, 2009 1:11 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Error on Names documentation page
Sure.
C#:
public class Something
{
  public static Create()
  {
    Console.WriteLine("Creating Something");
    return new Something();
  }
  public Something()
  {
  }
}
IR:
class SomeSomething < Something
  def self.create
    puts "Creating SomeSomething!"
    super
  end
end
SomeSomething.create
# prints "Creating SomeSomething!
#         Creating Something"
If the IR method was named self.Create (with a capital C), the next will 
happen:
SomeSomething.create
# prints "Creating Something"
Thanks,
Shay.
----------------------------
Shay Friedman
http://www.ironshay.com
Follow me: http://twitter.com/ironshay
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core