You can use `(variable-reference->phase (#%variable-reference))`.

At Fri, 20 Jul 2018 17:03:27 -0400, David Storrs wrote:
> How can I answer the question "what phase level is this chunk of code
> running at?"
> 
> For example:
> 
> (displayln (~a "current phase level: " (current-phase-level)))  ; outputs 0
> (begin-for-syntax
>   (displayln (~a "current phase level: " (current-phase-level)))  ; outputs
> 1
> )
> 
> Long version:
> 
> I'm having some issues with providing macros and ending up with things
> being required at the wrong phase level. (At least, I'm fairly sure that's
> what's happening.)
> 
> I've played around with various combinations of for-syntax and for-template
> on my provide and require lines without success, I've read the Guide and
> much of the Reference on phase level, and I've gone through the section on
> syntax objects, as well as through the macro-debugging library and
> DrRacket.  (Which I typically don't use, so maybe I'm just missing it.)
> 
> I'd like to try a little longer to get this on my own, and the code in
> question is reasonably long which is why I'm asking this question before
> taking the time to pare it down to a minimal example.
> 
> -- 
> 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.

-- 
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