gabriele renzi wrote: > Austin Ziegler ha scritto: > >>(ruby does/has?)5 PEP 318: Decorators for Functions and Methods > > > > > > Ruby has this implicitly, because its object model is far more > > consistent. The only thing that may improve this is an RCR that > > makes it easier to deal with custom decorators by having def return > > the Symbol of the method name. Probably :) > > this does not relate to the object model. > A common python idiom is always been: > class Foo(object): > def foo(): > ... > foo=somedecorator(foo) > > wich is basically what we do in ruby with: > class Foo > def foo > ... > end > somedecorator :foo > end > > Btw, I hope matz will accept RCR 277 soon > http://rcrchive.net/rcr/show/277 If the Ruby parser could determine, whether a "def" statement is used inside another expression (e.g. "public def"), then it would be great if it would return a Method object. If it's in no expression (plain class/module scope), it should return nil. Not sure, if this is possible at all. A Method object is much better than a Symbol! Regards, Michael