[racket-dev] internal-definition-context-seal doesn't seem to do anything

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Fri Aug 15 14:33:35 EDT 2014

The docs say that if I make an internal definition context with
syntax-local-make-definition-context, I have to seal it with
internal-definition-context-seal, otherwise an exception gets raised.
But I can't get this to happen. Does someone have an example that
causes the exception to get thrown?

For example, this program from the racket tests produces the same
result if I comment out the seal line. Other tests behave similarly.

(define-syntax (bind stx)
  (syntax-case stx ()
    [(_ handle def)
     (let ([def-ctx (syntax-local-make-definition-context)]
           [ctx (cons (gensym 'intdef)
                      (let ([orig-ctx (syntax-local-context)])
                        (if (pair? orig-ctx)
           [kernel-forms (list #'define-values)])
       (let ([def (local-expand #'def ctx kernel-forms def-ctx)])
         (syntax-case def ()
           [(define-values (id) rhs)
              (syntax-local-bind-syntaxes (list #'id) #f def-ctx)
              (internal-definition-context-seal def-ctx)
                  (define-values (id) rhs)
                  (define-syntax handle (quote-syntax id))))]
           [_ (error "no")])))]))

(define-syntax (nab stx)
  (syntax-case stx ()
    [(_ handle)
     (syntax-local-value #'handle)]))

(let ()
  (bind h (define q 5))
  (define q 8)
  (nab h))

Posted on the dev mailing list.