[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macros; lexcial scope



In article <8805251659.AA00682@tub.UUCP> in comp.lang.scheme, net@tub.bitnet
(Oliver Laumann) discusses the scoping of macros in Scheme and lexically
scoped Lisps:

>    (define x 1)
>    (define-macro (m) x)
> 
>    (let ((x 2))
>      (m))
> 
> Would you expect that (m) evaluates to 1 or to 2?

This evaluates (correctly) to 1 in T.

> Now consider a slighly more complex example:
> 
>    (define x 1)
> 
>    (let ((x 2))
>      (define-macro (m) x)
>      (let ((x 3))
>        (m)))
> 
> In both Common Lisp and C-Scheme, this evaluates to 1.  My mind boggles.

This evaluates (correctly) to 2 if you use DEFINE-SYNTAX in T, but if you use
DEFINE-LOCAL-SYNTAX this evaluates to 1.  Is this a bug, or am I missing
something?

-- Ashwin.

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin
BITNET:  Ram@yalecs