In working on the Trepanning debugger for Perl which in large part is modernizing and modularizing perl5db, I keep running into the limitations of eval.
In both Ruby and Python, one can pass arguments in addition to the string to evaluate which controls the environment or context that evaluation uses. Lacking this, evaluations in perl5db need to be done in the DB namespace - but inside the "eval", one must first switch back to the debugged program namespace, e.g. "main". Consider what this does in debuggers that want to modularize code and move code and modules out of the DB namespace. In the trepanning debugger there is an object which is the command processor. It is pretty much a self-contained read-eval-print loop. But the eval part of it has to go back to DB any time an evaluation needs to be done. So some mechanism needed to ping-pong values back and forth between the command loop and DB. Another limitation of the Perl debuggers is that they can only evaluate expressions which may contain "my" variables in the context of the point of the stopped program, not call-stack frames further down. I've briefly looked at PadWalker which can look at "my" and "our" variables on a call stack. And while this is very useful, it is not the same as being able to evaluate a string in the context of a stack frame. Has anyone tried to create such an eval? A simple suggested interface would be to pass it an integer which indicates the call stack frame to use. Thanks.