Here is a strip down example of a case that worked before and gave an error with the new version. I was only interested in the information if the argument to mac could be expanded to something bound or not. So the quick solution here was to wrap the provide in begin and expand it in 'top-level.


PS: The whole local-expand construct is only needed in my case to work around the unfortunate behavior that racket lacks source locations in error message for transformer phase. It would really, really simplify debugging if that could be changed.

;; --- example

#lang racket
(require (for-syntax racket))

(define-syntax (mac stx)
  (syntax-case stx ()
    [(_ id val)
       (define e (local-transformer-expand #'val
                                           ;; 'module worked before
       #`(begin-for-syntax #,e))]))

  (define C 'C)

  (define-syntax (B stx)
    (syntax-case stx ()
       #'(provide C)])))

(mac id (B))

On Thu, 01 Aug 2013 14:16:14 +0200, Matthew Flatt <> wrote:

I removed those options because the implementation did not look
sensible for those cases.

Implementation aside, using 'module-begin doesn't make sense to me. A
form in the place of `#%module-begin' is always expanded at phase-level
0, so there isn't really.

I'm less certain about 'module. It may make sense to use 'module and
get the same effect as wrapping the form with `begin-for-syntax',
expanding with `local-expand', and removing the expansion again. Do you
have an example where you use 'module?

At Thu, 1 Aug 2013 10:12:16 +0200, Tobias Hammer wrote:

Commit e51ac9cc [1] from about a month ago changed the allowed values for
local-transformer-expands context-v argument. It now refuses 'module and
'module-begin. Previously i could simply pass the result from
I am not sure what i should pass now and what implications the change has.
Any hints appreciated.


  Racket Developers list:

Tobias Hammer
DLR / Robotics and Mechatronics Center (RMC)
Muenchner Str. 20, D-82234 Wessling
Tel.: 08153/28-1487
 Racket Developers list:

Reply via email to