From: Jonas Pfenniger Date: 2006-07-14T21:49:53+09:00 Subject: Re: About MyClass#my_method On 14/07/06, transfire@gmail.com wrote: > Jonas Pfenniger wrote: > > MyClass#my_method would replace MyClass.instance_method(:my_method) > > It has it's merits. I have to agree, since we use the notation all the > time. But it doesn't match up with what :: does. And if you change that > you break a lot of code. But IMHO that shouldn;t count it out > neccessarily. Yes but Matz said to optimize breakage for 2.0 so this might be worthwile. I remember that lisp guy saying that ruby methods where not first-class methods (didn't find the thread). Which is wrong, but such shortcuts are nice for metaprogramming. > > and > > > > def MyClass#my_method end would replace class MyClass; def my_method end end > > This is already done: > > def MyClass.my_method > ... No, this is a class method. You have to use MyClass.define_method(:my_method) {} to define a new instance method. > > Similarily, I was also thinking that :: could be used for class methods. > > > > What do you think ? > > > > The biggest drawback I see actually is that it would impose comments > > to have one space before. Like : > > MyClass#some comment #=> Error > > MyClass #some comment #=> All OK > > Prbaby not such a big deal. > > I would search the mailing list though, this has been mentioned before. I've tried but nothing really nice went out. Do you have and nice keywords I could use ? -- Cheers, zimbatm http://zimbatm.oree.ch