[racket] Racket non-gui debugger

From: Piotr Klibert (piotr.klibert at 10clouds.com)
Date: Tue May 28 10:00:16 EDT 2013

Hello,

I like an idea of setting breakpoint and when it is reached during runtime
dropping into the interactive shell. It's done in Python with pdb and in
one of the Schemes (Gambit?). I tried, but I couldn't make anything similar
for Racket.

At first I looked at namespaces and (read-eval-print-loop), but that didn't
work. I could "load" the top-level module namespace, but I couldn't hook
into the namespace inside the function (if it even exists as a namespace).

Then I tried to look inside the GUI debugger, and I realized that it uses a
macro which inserts some function call before and after every expression.
The debugger code was too hard for me to comprehend fully and I couldn't
make it work the way I wanted, too.

It was some time ago, so sorry for the lack of specifics, but my question
is: is it possible, and how, to do something like this in Racket:

    (define (fun)
      (define a 9)
      (define b '(a b c))
      (let
          ([d display])
        (set-trace))
      (displayln "We're here!"))

    (fun) ;; starts repl, where

    > a
    9
    >(d b)
    (a b c)> (continue)
    We're here!

Thanks!

Best regards,
Piotr Klibert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130528/71271b89/attachment.html>

Posted on the users mailing list.