[ sisc-Bugs-946693 ] 'syntax-rules' and 'when' causes error

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
Bugs item #946693, was opened at 2004-05-03 02:01
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=946693&group_id=23735

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Chris Double (doublec)
Assigned to: Nobody/Anonymous (nobody)
Summary: 'syntax-rules' and 'when' causes error

Initial Comment:
Given the following macro defined using syntax-rules:

(define-syntax test1
  (syntax-rules ()
    ((test1 blah ...)
     (when #t
       (begin blah ...)))))

This code gives an error:

(let ((thunk (lambda () (display "a\n")))) (test1
(display "b\n") (thunk)))
b
Error: undefined variable 'thunk'.

Replacing the 'when' with an 'if' makes things work fine:

(define-syntax test1
  (syntax-rules ()
    ((test1 blah ...)
     (if #t
       (begin blah ...)))))

(let ((thunk (lambda () (display "a\n")))) (test1
(display "b\n") (thunk)))
b
a

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=946693&group_id=23735


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.