[plt-scheme] misplaced begin-for-syntax causes weirdness in drscheme?

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Thu Jun 1 16:48:55 EDT 2006

Hi everyone,

I've been experimenting with syntax stuff as usual, and isolated some 
weirdness to the following test case:


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(module test mzscheme
   (define-syntax (foo stx)
     (syntax-case stx ()
       [(_ x)
        #'(begin
            (begin-for-syntax
                (printf "~a~n" x))
            x)]))

   (let ((x (foo 3)))
     (printf "here I am: ~a" x)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Under mzscheme, this fails predictibly:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
repl-1:6:11: begin-for-syntax: allowed only at the top-level or a module 
top-level in: (begin-for-syntax (printf "~a~n" 3))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

But under DrScheme 301.15-svn22may2006, DrScheme appears to go crazy 
trying to expand the syntax.  Does anyone know why this is happening?

Thanks!


Posted on the users mailing list.