From: Eric Hodel Date: 2005-11-02T07:39:57+09:00 Subject: Re: Would you find it useful? On Nov 1, 2005, at 1:16 PM, Jeff Wood wrote: > ... I've been thinking about this for a little while, but, would > any of you > find it useful to have ruby be able to provide you with the source > of a > function ... You already can do that with ruby2c and ZenHacks. > I could see a number of uses. Including being able to modify the > function at > run time, or to be able to see the parameter list ... or other things. > > Anyways, I was thinking of something like: > > func_body = Object.method( :to_s ).src > > func_body.replace( "\* 3", "\* 4" ) > > Object.class_eval( func_body ) > > ... what do you think? MetaRuby is rewriting Ruby in itself. When we're done you can get the source for Object#to_s, but we haven't gotten that far yet. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04