Would you find it useful?

J

Jeff Wood

------=_Part_389_19695979.1130879796947
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

... 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 a=
t
run time, or to be able to see the parameter list ... or other things.


Anyways, I was thinking of something like:


func_body =3D Object.method( :to_s ).src

func_body.replace( "\* 3", "\* 4" )

Object.class_eval( func_body )

... what do you think?

j.

--
"http://ruby-lang.org -- do you ruby?"

Jeff Wood

------=_Part_389_19695979.1130879796947--
 
E

Eric Hodel

... 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.
 
J

Jeff Wood

------=_Part_2136_4055289.1130885023757
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Yep, that's the second link to the Zen stuff ...

I went and looked at things, looks like what I'm after ...

Thanks all.

j.

You already can do that with ruby2c and ZenHacks.


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.


--
"http://ruby-lang.org -- do you ruby?"

Jeff Wood

------=_Part_2136_4055289.1130885023757--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top