I agree, I don't like the idea of doing something that conflicts with current Ruby standards.
I do like the prop_getter idea though, but that is essentially what we are talking about with an interop class method. I also have written class methods to do the Boolean idea before. Look through my CP_Bugger source to see some examples. JD -----Original Message----- From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Tomas Matousek Sent: Friday, July 23, 2010 11:01 AM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Why does attr_accessor create a property, but method is just a method? Unless CRuby implements properties I don't like introducing property "names" that are different from foo, foo= pattern. For now that's just not the Ruby way. Tomas -----Original Message----- From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Jörg W Mittag Sent: Friday, July 23, 2010 9:16 AM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Why does attr_accessor create a property, but method is just a method? Brian Genisio wrote: > It is a good idea, but I have tried this already, and it still fails. So did I :-) > By > re-defining the method after attr_accessor, you blow away whatever > magic happens that causes it to be a property at interop time. > > Unless... you are suggesting that this is how it SHOULD work. Yes, that's what I meant. > I think either approach makes sense. A special interop class method > is nice because it is explicit. Having method redefinition do the job > is nice because it doesn't require a special class method :) > > What does everyone else think? Actually, I believe both make sense. Having method redefinition not work simply violates at least *my* Principle of Least Astonishment, so it needs to be fixed anyway. But it alone is not enough: sometimes you might want to have different names for your .NET property and your Ruby methods. A good example might be a readonly boolean property: prop_getter :isValid => :valid? def valid? @is_valid end Actually, now that I think about it, what about just overloading `attr_accessor` and friends? In plain Ruby, attr_reader :isValid => :valid? is illegal anyway. Together with working method redefinition, I believe this would cover all use cases, no? [Note: the risk is that at some time in the future, Ruby might allow this notation to have the getter/setter names decoupled from the instance variable names. Actually, now that I think about it, I might suggest that right now :-) It always bugged me that you cannot simply define boolean accessors because that would try to create a @valid? instance variable, which is illegal.] jwm _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core