On Sun, Oct 26, 2008 at 12:20 AM, Curt Hagenlocher <[EMAIL PROTECTED]> wrote: > > However, virtual calls from a C# application back into IronRuby are a > different matter, due Ruby's dynamic nature. Here there is both a > performance cost and a semantic cost for performing multiple lookups. The > performance cost results from the fact that we have to check for two > different symbol names on every CLS call to this method before we can > identify that we need to delegate to the base class implementation. (To be > fair, this, too could be cached, albeit with slightly greater difficulty.) > The semantic cost is based in the confusion resulting when methods with both > names are defined on the class. Should we call method "dispose" or method > "Dispose"? or both?
This is a tough one, glad I do not have to make the call. Pitfalls and trouble every way I try to think of it and type a response. :) My gut tells me that capitalization matters, regardless of The Ruby Way, when it comes to .NET. If you want to write a new Dispose, def Dispose. > Finally, as you're probably aware by now, capitalization in Ruby is not > simply a matter of convention. In many cases, the parser actually treats > identifiers which start with a capital letter differently than it does > identifiers that start lower case. Now it turns out that method names are > one of the places where Ruby doesn't draw this distinction, but I'd guess > that many Ruby programmers look at any identifier starting with a capital > letter and think "that's a constant". But given the following: def Foo "Bar" end Foo() what Ruby programmer would look at Foo and still think it is a constant? Of course, if I would have made it lowercase, the parentheses would not be necessary. My point is that the parentheses tell the reader that it is not a constant, but a method. Is there a situation where Foo could appear legally, as defined above, without parentheses and be confused for a constant? _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core