[racket] Syntax certificate question

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat Jun 4 15:17:39 EDT 2011

2011/6/4 Carl Eastlund <cce at ccs.neu.edu>:
> A question for the syntax certificate connoisseurs out there.  The
> program below produces the following error message:
>  compile: access from an uncertified context to unexported variable
> from module: "A" in: identity
> Why is the reference to identity from within the module that binds it
> illegal?  Is that syntax object somehow not certified correctly, or
> does syntax-local-bind-syntaxes result in some illegal destructuring
> of its input?  I imagine I can work around this by providing identity
> so that the certificate system ignores it, but I'd like to at least
> understand what's causing this error.
> #lang racket/load
> (module A racket
>  (provide with-macro)
>  (require (for-syntax racket/syntax syntax/parse))
>  (define-for-syntax (identity x) x)

Isn't this a phase 1 binding?

>  (define-syntax with-macro
>    (syntax-parser
>      [(_ lhs:id rhs:expr e:expr)
>       (define ctx (syntax-local-make-definition-context))
>       (syntax-local-bind-syntaxes (list #'lhs) #'(identity rhs) ctx)

And this a phase -1 (template) use, which normally goes for the phase 0 binding

>       (internal-definition-context-seal ctx)
>       (internal-definition-context-apply ctx #'e)])))
> (module B racket
>  (require 'A (for-syntax syntax/parse))
>  (with-macro thunk (syntax-parser [(_ e:expr) #'(lambda () e)])

And this is a phase 0 use?

Is that the problem?


>    (thunk (printf "Boo!\n"))))
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.