[ANN] remembered_evals 0.0.4 -- debugging help for eval

R

Roger Pack

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
 
C

Caleb Clausen

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

Roger Pack

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
 

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

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top