Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread Dmitry Pavlov
Oh, syntax-parameter-value has helped. #lang racket (require (for-syntax syntax/parse syntax/transformer) racket/stxparam) (define-syntax-parameter my-info '()) (define-syntax (access stx)   (syntax-parse stx     ((_) (printf "my-info = ~v\n" (syntax-parameter-value #'my-info))  

Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread Dmitry Pavlov
You can "pass" information from one macro to another by binding information to an identifier defined to be a syntax parameter that both macros have in scope. You would need to functionally update its value for each rebinding. Its value would be retrievable with syntax-local-value. Like

Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread 'Dionna Amalie Glaze' via Racket Users
You can "pass" information from one macro to another by binding information to an identifier defined to be a syntax parameter that both macros have in scope. You would need to functionally update its value for each rebinding. Its value would be retrievable with syntax-local-value. For example,

Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread Dmitry Pavlov
Amalie, Thank you, this is impressive and helpful. I did not know about syntax-local-value (I also am not certain that I know it now good enough). However, I did not mean to use the (my-let)'s "definition" of x to pass information to (access). (Also, can (access y) fail in a customizable

Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread 'Dionna Amalie Glaze' via Racket Users
syntax-local-value is likely what you'll want to use here. You can bind your x to a compile-time value that you can access with syntax-local-value. You can even make that value a struct with #:procedure prop:procedure and have its procedure be a syntax transformer (so it can expand into something