I don&#39;t think this is PLT specific, so I apologize if this should be on a more general scheme list.<br><br>I&#39;m interested in adding a generic hook to evaluate a piece of code at an arbitrary point in my program.&nbsp; This would be useful for debugging purposes.&nbsp; For instance:
<br><br>(let ((x 5))<br>&nbsp; ;(do a bunch of stuff with x)<br>&nbsp; (write (eval (read))))<br><br>Obviously this isn&#39;t very useful outside of a loop or other more complicated idea, but this is just a toy to show the problem.&nbsp; When (read) runs, I would like to type in something like:
<br><br>(set! x 7)<br><br>This doesn&#39;t work.&nbsp; The error is that &#39;x&#39; is unbound.&nbsp; So I tried:<br>...<br>&nbsp; (write (eval (read) (interaction-environment))))<br><br>and that didn&#39;t work either.&nbsp; It seems like I can&#39;t get to the environment that contains the lexical closure created by the initial (let...).
<br><br>Is there any way around this?&nbsp; I supposed I could write my own (mini) version of eval, but that seems pretty extreme.&nbsp; How can I get access to the lexical environment at the point (eval) is executed so I can inject arbitrary code?
<br><br>Thanks for any tips!!!<br><br>Mike<br clear="all"><br>-- <br>Mike J. Bell on gmail