Is there a way to dynamic-require an identifier provided at phase 1?

#file x.rkt
#lang racket
(provide (for-syntax x)) ; x is provided at phase 1
(define-for-syntax x 3)

#file use.rkt
#lang racket
(dynamic-require-from-phase-1 "x.rkt" 'x)
;=> 3

I could do it by defining another module that did the phase shift:

#file x.rkt
#lang racket
(provide (for-syntax x))
(define-for-syntax x 3)

(module* ct racket/base
  (provide (for-meta -1 (all-from-out (submod ".."))))
  (require (for-meta -1 (submod ".."))))

#file use.rkt
#lang racket
(dynamic-require '(submod "x.rkt" ct) 'x)

But that requires an extra module to be defined already. I could also do it 
with eval, but that feels wrong and shouldn't be necessary. There should be a 
way to do this without needing eval.

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