Excellent! Thanks.

On Wed, Jul 17, 2019 at 01:46:10PM -0700, gfb wrote:
> On Wednesday, July 17, 2019 at 4:35:21 PM UTC-4, William J. Bowman wrote:
> >
> > I'm trying to write a macro that reflects on which identifiers are in 
> > scope in 
> > the environment when it runs, and on the identifiers in scope for its 
> > generated 
> > code. 
> > It should act something like this: 
> >
> >   (define-syntax (display-env stx) 
> >     (syntax-case stx () 
> >       [(_) 
> >        (printf "Env: ~a" (local-environment))])) 
> >
> >   > (lambda (x) (display-env) x) 
> >   Env: '(x) 
> >   #<procedure> 
> >   > (lambda (x) (let-syntax ([y (make-rename-transformer #'x)]) 
> > (display-env) y)) 
> >   Env: '(y x) 
> >   #<procedure> 
> >
> > Presumably, the expander knows which identifiers are in scope, so I 
> > *ought* to 
> > be able to get my hands on that set. 
> >
> > namespaces aren't the thing; they only give me access to the top-level 
> > definitions, as far as I can tell. 
> > I also want access to any lexical identifiers introduced by `λ` or `let` 
> > or 
> > `let-syntaxes` or `let-values` etc. 
> > But I want to be able to use them pretty much like namespaces: get the 
> > list of 
> > symbols in scope, and get their values and identifiers. 
> >
> > Any one know how to do this? 
> >
> > -- 
> > William J. Bowman 
> >
> 
> Take a look at  syntax-debug-info 
> <https://docs.racket-lang.org/reference/stxops.html#(def._((quote._~23~25kernel)._syntax-debug-info))>
>  
> , which you can see used in  
> https://github.com/AlexKnauth/debug/blob/master/debug/repl.rkt 
> .
> <https://github.com/AlexKnauth/debug/blob/master/debug/repl.rkt>
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/7b0eb8f1-b9cb-4065-9a90-1708237d5040%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20190717210210.GE86511%40williamjbowman.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to