[plt-scheme] shouldn't this work?

From: Derick Eddington (derick.eddington at gmail.com)
Date: Tue Feb 20 08:37:46 EST 2007

This top-level begin form splicing does not seem to be working (with 360
nor 369.8):

Welcome to MzScheme version 360, Copyright (c) 2004-2006 PLT Scheme Inc.
> (define-syntax hmm
    (syntax-rules ()
      [(_)
       (begin
         (define x 'lala)
         (printf "can use x from here: ~s~n" x))]))
> (hmm)
can use x from here: lala
> x  ;; shouldn't this binding exist?
reference to undefined identifier: x

 === context ===
repl-loop

> (begin  ;; just for comparison
    (define y 'blah) 
    (printf "y = ~s~n" y))
y = blah
> y
blah

DrScheme's macro stepper shows (hmm) expanding to the expected begin
form and the printf using x works, yet x is not bound at the top-level
but y is.

-- 
: Derick
----------------------------------------------------------------



Posted on the users mailing list.