From: gabriele renzi Date: 2004-04-23T23:59:07+09:00 Subject: Re: should method() returns singletons ? il Fri, 23 Apr 2004 23:28:19 +0900, Mauricio Fern�ndez ha scritto:: > >I see two possibilities: >you either > * access the method repeatedly using the symbol: in that case you can > store the information in a hash somewhere (say a hash in the singleton > class of the object), using the method name as the key just done this :) > * keep the Method or UnboundMethod (if using instance_method) objects > around; then you can add that info to the object itself directly, > using its instance vars + singleton methods. yes, but the logical place to hold this is an hash so you go back to #1 >>Note that I needed it just for some little playing (copying the >>examples from the article at onjava.com about annotations in java 1.5) >>so I won't bother if I can't have it :) > >Per-method annotations as shown in >http://www.onjava.com/pub/a/onjava/2004/04/21/declarative.html >can be implemented trivially using Module#method_added (it's the same >technique used commonly to implement docstrings). > exactly what I did :)