... 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 ...
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.
... 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 ...
... what do you think?
* What's the best way to treat methods not written in Ruby?
* Why not an abstract syntax tree rather than a flat string?
... 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.
I went and looked at things, looks like what I'm after ...
Thanks all.
j.
···
On 11/1/05, Eric Hodel <drbrain@segment7.net> wrote:
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.