[plt-scheme] question about eval in macro
Aren't you mean
(define-syntax s (syntax-rules () ((_ x) (eval 'x))))
(s '#0=(1 . #0#))
? It works fine.
Chongkai
Jos Koot wrote:
> 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
> ------------------------------------------------------------------------
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>