[plt-scheme] question about eval in macro

From: Jos Koot (jos.koot at telefonica.net)
Date: Thu Aug 2 00:05:59 EDT 2007

Who can help me understand the following two ???s ?

(eval ''#0=(1 . #0#)) ; --> #0=(1 . #0#) ; ok
(define s (syntax-rules () ((_ x) (eval 'x))))
;(s '#0=(1 . #0#)) --> bug ?: bad syntax in: #0=(1 . #0#) ; ???
;(s ''#0=(1 . #0#)) --> bug syntax-source: expects argument of type <syntax>; given '#0=(1 . #0#) ; ???

(define-syntax t (syntax-rules () ((_ x) (eval `x))))
;(t '#0=(1 . #0#)) ; never returns ; ok, because quasiquote allocates and looks inside the circular list for unquote
(t ,''#0=(1 . #0#)) ; --> #0=(1 . #0#) ; ok
(t ','#0=(1 . #0#)) ; --> #0=(1 . #0#) ; ok

Is this a bug or am I missing some profound understanding?
I know that the use of eval is not encouraged, but I need it in my own test system (allowing multiple values, checking standard output and checking for the correct error messages when expected)
Thanks, Jos koot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070802/ff52acef/attachment.html>

Posted on the users mailing list.