I was going to suggest `dynamic-require-for-syntax`, but it seems to do exactly 
the same thing as `dynamic-require`, i.e. give the value of a phase-0 provided 
identifier. Is this normal?

The `eval` trick is a good idea, I would say. From the couple of times I have 
used dynamic-require, I have felt that it was pretty limited concerning 
shifting phases.

The thing I found to be the most difficult is to extract the phase 1 value 
bound to a macro via define-syntax. Following your `eval` idea, I managed to do 
that using 3D syntax. I suppose it's safe, as the 3D syntax object is created 
on the fly during `eval` and promptly discarded, therefore it should never need 
to be marshalled into a compiled file.

(eval #'(begin
           (module m racket/base
             (require (for-syntax racket/base) "x.rkt")
             (provide (for-syntax x-val))
             (define-syntax (get-val stx)
               (syntax-case stx ()
                 [(_ name)
                  #`(define-for-syntax name #,(syntax-local-value #'x))]))
             (get-val x-val))
           (require (for-meta -1 'm))
           x-val))

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