"gabriele renzi" <surrender_it / remove.yahoo.it> schrieb im Newsbeitrag news:l8qh80pjbqhfsdo9m1grr3uc4ahgtvngb4 / 4ax.com... > Hi gurus and nubys, > > I wonder why this happen: > >> (method :foo).id > => 21345560 > >> (method :foo).id > => 21341312 > >> (method :foo).id > => 21336776 > > Would'nt make more sense to have just a singleton method object > referring to the same method ? > > My real problem is attaching some metadata to a method, allowing it to > be retrieved at any time, somehow like MetaTags does > (yet not looked at it's code, but IIRc it uses a big class level hash > collecting all the metainformations) some suggestions ? We had this discussion some weeks ago, when someone else posted a quite similar question (method as hash key). AFAIR Matz wanted to consider changing #hash and #eql so Method instances can be reasonably used as hash keys. Singletons might have some drawbacks that he does not want to pay the price for. The major issue is that they have to be stored somewhere and thus take up mem even when they are no longer used. Making Method hash key compatible is completely sufficient IMHO. Regards robert