Re: Debugging REPL
Igor Hjelmstrom Vinhas Ribeiro <[email protected]> Sat, 16 May 2009 01:37:49 -0400
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
--===============2815731761869002757== Content-Type: multipart/alternative; boundary=0016e6de152429ed75046a00f638 --0016e6de152429ed75046a00f638 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Daniel, This is very useful - thank you for this tip. Is the code in public domain? Regards, Igor. On Tue, Jun 12, 2007 at 08:40, Daniel Sadilek < [email protected]> wrote: > Sorry, there was a bug in the last post. Correct form of debug must be: > > (define-syntax debug > (syntax-rules () > ((_ var ...) > (begin > (print "Debugging. Available lexical bindings: " '(var) ...) > (let ((child-env (make-child-environment (interaction-environment)))) > (putprop 'var child-env var) ... > (with-environment child-env (lambda () > (repl))) > (print "Debugging ended.")))))) > > > On 6/12/07, Daniel Sadilek <[email protected]> wrote: > > I found a workaround: > > > > (define-syntax debug > > (syntax-rules () > > ((_ var ...) > > (begin > > (print "Debugging. Available lexical bindings: " '(var) ...) > > (putprop 'var (make-child-environment (interaction-environment)) > var) ... > > (repl) > > (print "Debugging ended."))))) > > > > This special syntactic form can be used like this: > > > > (define (f x) > > (let ((sq (* x x))) > > (debug x sq) > > (+ sq sq))) > > > > Does anyone know a better solution? > > > > Btw, I use the SchemeScript IDE and really like the editing style that > > is made possible with the above debug-form. You can put "(debug > > some-vars)" inside a procedure and execute it (or some other procedure > > that calls it). Then, with access to the local variables, you can > > write your code inside the procedure -- right in place -- and evaluate > > by pressing Ctrl+Enter. If finished, you exit the debug REPL. > > I'm interested, what is you preferred "editing cycle"? > > > > Best regards > > Daniel Sadilek > > > > On 6/12/07, Daniel Sadilek <[email protected]> wrote: > > > Hello all, > > > > > > for debugging, I want to start a REPL inside a procedure so that the > > > lexical bindings inside the procedure are available. > > > > > > For example, if anything goes wrong in this procedure: > > > > > > (define (f x) > > > (let ((sq (* x x))) > > > (+ sq sq))) > > > > > > I would like to be able to change it to > > > > > > (define (f x) > > > (let ((sq (* x x))) > > > (debug-repl) > > > (+ sq sq))) > > > > > > and run it again. A REPL should be started in which I can access x and > > > sq. Is this somehow possible? > > > I couldn't figure out how I can make the lexical bindings accessible. > > > Somehow the current environment would need to be accessed, wouldn't > > > it? > > > > > > Best regards > > > Daniel Sadilek > > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Sisc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sisc-users > --0016e6de152429ed75046a00f638 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Daniel,<br><br>=A0=A0 This is very useful - thank you for this tip. Is the = code in public domain?<br><br>Regards,<br>=A0Igor.<br><br><div class=3D"gma= il_quote">On Tue, Jun 12, 2007 at 08:40, Daniel Sadilek <span dir=3D"ltr">&= lt;<a href=3D"mailto:[email protected]">[email protected]= -berlin.de</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, = 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Sorry, there was = a bug in the last post. Correct form of debug must be:<br> <div class=3D"im"><br> (define-syntax debug<br> =A0(syntax-rules ()<br> =A0 ((_ var ...)<br> =A0 =A0(begin<br> =A0 =A0 =A0(print "Debugging. Available lexical bindings: " '= ;(var) ...)<br> </div> =A0 =A0 =A0(let ((child-env (make-child-environment (interaction-env= ironment))))<br> =A0 =A0 =A0 =A0(putprop 'var child-env var) ...<br> =A0 =A0 =A0 =A0(with-environment child-env (lambda ()<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (r= epl)))<br> =A0 =A0 =A0 =A0(print "Debugging ended."))))))<br> <div><div></div><div class=3D"h5"><br> <br> On 6/12/07, Daniel Sadilek <<a href=3D"mailto:[email protected]= in.de">[email protected]</a>> wrote:<br> > I found a workaround:<br> ><br> > (define-syntax debug<br> > =A0 (syntax-rules ()<br> > =A0 =A0 ((_ var ...)<br> > =A0 =A0 =A0(begin<br> > =A0 =A0 =A0 =A0(print "Debugging. Available lexical bindings: &qu= ot; '(var) ...)<br> > =A0 =A0 =A0 =A0(putprop 'var (make-child-environment (interaction-= environment)) var) ...<br> > =A0 =A0 =A0 =A0(repl)<br> > =A0 =A0 =A0 =A0(print "Debugging ended.")))))<br> ><br> > This special syntactic form can be used like this:<br> ><br> > (define (f x)<br> > =A0 (let ((sq (* x x)))<br> > =A0 =A0 (debug x sq)<br> > =A0 =A0 (+ sq sq)))<br> ><br> > Does anyone know a better solution?<br> ><br> > Btw, I use the SchemeScript IDE and really like the editing style that= <br> > is made possible with the above debug-form. You can put "(debug<b= r> > some-vars)" inside a procedure and execute it (or some other proc= edure<br> > that calls it). Then, with access to the local variables, you can<br> > write your code inside the procedure -- right in place -- and evaluate= <br> > by pressing Ctrl+Enter. If finished, you exit the debug REPL.<br> > I'm interested, what is you preferred "editing cycle"?<b= r> ><br> > Best regards<br> > Daniel Sadilek<br> ><br> > On 6/12/07, Daniel Sadilek <<a href=3D"mailto:[email protected]= -berlin.de">[email protected]</a>> wrote:<br> > > Hello all,<br> > ><br> > > for debugging, I want to start a REPL inside a procedure so that = the<br> > > lexical bindings inside the procedure are available.<br> > ><br> > > For example, if anything goes wrong in this procedure:<br> > ><br> > > (define (f x)<br> > > =A0 (let ((sq (* x x)))<br> > > =A0 =A0 (+ sq sq)))<br> > ><br> > > I would like to be able to change it to<br> > ><br> > > (define (f x)<br> > > =A0 (let ((sq (* x x)))<br> > > =A0 =A0 (debug-repl)<br> > > =A0 =A0 (+ sq sq)))<br> > ><br> > > and run it again. A REPL should be started in which I can access = x and<br> > > sq. Is this somehow possible?<br> > > I couldn't figure out how I can make the lexical bindings acc= essible.<br> > > Somehow the current environment would need to be accessed, wouldn= 't<br> > > it?<br> > ><br> > > Best regards<br> > > Daniel Sadilek<br> > ><br> ><br> <br> -------------------------------------------------------------------------<b= r> This SF.net email is sponsored by DB2 Express<br> Download DB2 Express C - the FREE version of DB2 express and take<br> control of your XML. No limits. Just data. Click to get it now.<br> <a href=3D"http://sourceforge.net/powerbar/db2/" target=3D"_blank">http://s= ourceforge.net/powerbar/db2/</a><br> _______________________________________________<br> Sisc-users mailing list<br> <a href=3D"mailto:[email protected]">[email protected]= forge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/sisc-users" target= =3D"_blank">https://lists.sourceforge.net/lists/listinfo/sisc-users</a><br> </div></div></blockquote></div><br> --0016e6de152429ed75046a00f638-- --===============2815731761869002757== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects --===============2815731761869002757== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Sisc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sisc-users --===============2815731761869002757==--