> On Jul 13, 2016, at 3:28 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
> 
> At Wed, 13 Jul 2016 14:16:11 -0400, Alex Knauth wrote:
>> 
>> Thanks. So defining it as a function won't work. But if I define it as a 
>> macro, can I get more information out of it?
> 
> Instead of
> 
> (define (f x y)
>   ;; x and y are local variables
>   (debug-repl/stx))
> 
> you could create a `define-buggy`
> 
> (define-buggy (f x y)
>   ;; x and y are local variables
>   (debug-repl/stx))
> 
> where `define-buggy` expands to include references to `x` and `y`,
> perhaps in cooperation with `debug-repl/stx`:
> 
> (define-values (f)
>   (lambda (x y)
>     ;; x and y are local variables
>     (debug-repl (hash 'x x 'y y))))
> 
> Of course, you can also set up a language where `define` means
> `define-buggy` or where `#%module-begin` parses its expanded body.
> The "Debug" button in DrRacket works something like that, but it's
> implemented as an external pass over the output of `expand`, instead of
> as a macro.

But then if there were any local variables introduced by any form that I didn't 
define as a "buggy" version, those wouldn't be included. Is there any way to 
get a macro to expand to the `(hash 'x x 'y y)` stuff?

It has to be in the lexical context of the syntax object somewhere, because the 
original function I made could distinguish between bound and unbound variables. 
Would there be a way to get a list of all the local variables in the lexical 
context? 

Alex Knauth

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to