[racket-dev] certificates and phases question
I'm puzzled by the behavior of the below program. In particular,
`get' doesn't work, but `get2' does, even though the only difference
is the phase at which they're executed. `get' produces the
certificate error:
compile: access from an uncertified context to unexported variable
from module: 'm1 in: x
Is there a way around this? Working at phase 1 has become inconvenient for me.
#lang racket/load
(module m1 racket
(define x 1)
(define-syntax (m stx) #'(list x))
(provide m))
(module m2 racket
(require 'm1 (for-syntax syntax/parse))
(define-syntax (get stx)
(syntax-parse stx
[(_ nm)
(with-syntax ([(app lst val) (local-expand #'(m) 'expression null)])
#'(define nm #'val))]))
(define-syntax (get2 stx)
(syntax-parse stx
[(_ nm)
(with-syntax ([(app lst val) (local-expand #'(m) 'expression null)])
#'(define-for-syntax nm #'val))]))
(get2 z))
(require 'm2)
--
sam th
samth at ccs.neu.edu