[racket] Understanding local-expand with definition contexts

From: Spencer Florence (florence at ccs.neu.edu)
Date: Mon Jan 5 09:49:03 EST 2015

Hey all,

I'm trying to use 'local-expand', however it seems to think its never in a
definition context. For example:

(require (for-syntax syntax/parse))
(define-syntax (test stx)
  (syntax-parse stx
    [(_ e)
     (define ctx
       (if (list? (syntax-local-context))
           (cons (gensym) (syntax-local-context))
           (list (gensym))))
     (local-expand
      #'e ctx null
      ;; result is the same with this uncommented
      #;(syntax-local-make-definition-context))]))
(let ()
  (test (define x 1))
  x)

errors with a "define-values: not in a definition context in:
(define-values (x) 1)"

Can anyone provide any insight into what is going on?

--spf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150105/4b8c59a5/attachment.html>

Posted on the users mailing list.