[racket] Overload #%module-begin

From: antoine (antoine.brand at sfr.fr)
Date: Wed Feb 26 16:43:45 EST 2014

Hello,

I would like to change the expansion of a given module.

I tested:
;; abc.rkt
#lang racket
(require racket/stxparam)

(define-syntax-parameter param-abc #f)

(define-syntax-rule (enable-abc body ...)
  (#%plain-module-begin
   (syntax-parameterize ([param-abc #t])
			body ...)))

(provide (rename-out [enable-abc #%module-begin])
	 (except-out
	  (all-from-out racket)
	  #%module-begin))

;;edf.rkt
(module garage "abc.rkt"
   (define (a) 1))


When i do a "raco expand edf.rkt" i get:
begin (possibly implicit): no expression after a sequence of internal definitions
  in: (begin (define-values (a) (lambda () 1)))

I have no idea by who this begin is introduced?

My ultimate goal is to change the expansion result of a module given some parameters.
example:
(expand
  (transform-the-list
    (read (open-input-file "some-file.rkt"))
    params))

where transform-the-list will transform something like '(module bla bla (%module-begin ...)) into '(module bla bal (%module-begin (syntax-parameterize (...) ...))) 

But for now i am stick with the first problem :)

Thanks you.

Posted on the users mailing list.