From: Robert Klemme Date: 2004-10-22T23:14:13+09:00 Subject: Re: Associating argument descriptions with method "Gavin Kistner" schrieb im Newsbeitrag news:08B3F283-2430-11D9-A186-000A959CF5AC@refinery.com... > SUMMARY > Why does the code at the end return nil for .arguments? > > DETAILS > I'm trying to come up with a system of describing arguments for certain > public methods, so that my GUI can provide reasonable input widgets and > constraints. My first idea was to associate this information with each > method, so that I could discover the public methods and then have each > method know how to describe itself. However, the following attempt at > this is leaving me with an empty array. > > I'm happy to go another way with this (store the descriptions in an > instance variable of the class, rather than on each method) but was > wondering why this doesn't do what I expected. The reason is most likely, that you always get new instances of UnboundMethod: >> def log(o) print o.id, ":", o.inspect, "\n" end => nil >> log String.instance_method( :length ) 134619252:# => nil >> log String.instance_method( :length ) 135146692:# => nil >> log String.instance_method( :length ) 135088144:# => nil >> log String.instance_method( :length ) 135066784:# => nil >> log String.instance_method( :length ) 135039148:# => nil >> log String.instance_method( :length ) 135027784:# => nil Kind regards robert