[ANN] remembered_evals 0.0.4 -- debugging help for eval

Please to announce the release of remembered_evals 0.0.4
Wasn't sure if anything like it existed, so wrote this gem.

remembered_evals:

A library to make debugging eval'ed code possible.

This library monkey patches Kernel.*eval to save eval'ed code to a cache
file before evaluating it (files saved to
~/._remembered_evals/hash_of_that_code).

You can thus debug [ex: using ruby-debug] THROUGH eval'ed code, now, as
well as see appropriate (useful) eval'ed code lines in exception
backtraces, instead of just eval(2) as the line number in the backtrace.

It also offers an additional tool for developers: Since it saves code
by hash value, and doesn't write over cached files, you can actually
edit eval'ed blocks and it will eval the edited version--i.e. it allows
you to override certain strings passed to eval [it uses yours instead of
the original]-- quite useful for debugging purposes if you use
meta-programming heavily.

http://github.com/rogerdpack/ruby_remembered_evals/tree/master

Install:
gem sources -a http://gems.github.com # if necessary
gem install rogerdpack-remembered_evals # may need to precede with sudo

And enjoy the eval'ed code bliss.

Feedback welcome rogerdpack @ github

···

--
Posted via http://www.ruby-forum.com/.

I've used this same trick myself several times to be able to debug
eval'd code. A library for it is nice. Let me make a suggestion, tho.
You ought to name the method something other than eval, since your new
implementation (unavoidably) changes the semantics of a
well-established and much used builtin method. How about
debuggable_eval? Some kind of switch to have it fall back to the plain
vanilla eval for production mode might be nice too.

···

On 7/18/09, Roger Pack <rogerpack2005@gmail.com> wrote:

Please to announce the release of remembered_evals 0.0.4
Wasn't sure if anything like it existed, so wrote this gem.

remembered_evals:

A library to make debugging eval'ed code possible.

This library monkey patches Kernel.*eval to save eval'ed code to a cache
file before evaluating it

I've used this same trick myself several times to be able to debug
eval'd code. A library for it is nice. Let me make a suggestion, tho.
You ought to name the method something other than eval, since your new
implementation (unavoidably) changes the semantics of a
well-established and much used builtin method. How about
debuggable_eval? Some kind of switch to have it fall back to the plain
vanilla eval for production mode might be nice too.

Yeah it turned out to be deftly useful at least once for me.

Currently when I want to use it for debugging, I'll add this line
require 'remembered_evals'
or comment it out when I'm *not* debugging.
For me that feels explicit enough. Thoughts?
=r

···

--
Posted via http://www.ruby-forum.com/\.