[Ironruby-core] Range#=== operator
Peter Bacon Darwin
bacondarwin at googlemail.com
Tue Nov 13 01:24:20 EST 2007
Would it be fair to follow this as a general rule: when coding Ruby methods
in C#, if you are calling code that is exposed as a method or operator in a
Ruby class or module then invoke it via a DynamicSite, if it is purely
private code to the C# method then call it directly?
From: ironruby-core-bounces at rubyforge.org
[mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of John Messerly
Sent: 08 November 2007 21:55
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Range#=== operator
Curt Hagenlocher wrote:
> Even builtins like the String or Range classes can have their
> comparison functions overridden by user code. So you really need to
> perform the comparison "in Ruby".
Exactly. The trick with library methods is to figure out what pattern MRI
uses. Typically, they do a method lookup on the type, which in our world
translates into a DynamicSite. However there are some places where they just
call some library method directly and bypass any overridden/monkeypatched
method. So it requires some experimentation :).
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.29/1124 - Release Date: 11/11/2007
More information about the Ironruby-core