[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
macros expanding into definitions
Date: Wed, 2 Dec 92 14:51:08 -0500
From: "Guillermo J. Rozas" <gjr@martigny.ai.mit.edu>
Reply-To: gjr@martigny.ai.mit.edu
Date: Wed, 2 Dec 92 14:03:15 -0500
From: "Mark Friedman" <markf@martigny.ai.mit.edu>
Reply-To: markf@martigny.ai.mit.edu
The initial (and I thought primary) motivation for all this was to
make internal defines consistent with top-level defines. The above
rules do not do this. For example, the above disallows:
(define x 0)
(define (foo)
(set! x 1)
(define x 2))
(foo)
x
It is not disallowed, it rewrites into
(define x 0)
(define (foo)
(let ((x))
(set! x 1)
(set! x 2)))
(foo)
x
...
In other words, the nice property of the new proposal is that if you
have a program that works, you can wrap it in
(let ()
<program>
)
and it still works the same way modulo assignments without definitions
of the names of the standard procedures (CAR, WRITE, etc.), although
if I remember correctly IEEE states that this is an error.
This is a very nice property. Compatible with your property, I would
still prefer that (if a variable is DEFINEd) a DEFINE of a variable be
required to precede SET!s of that variable. This is currently
required both at top level and internally. I think most beginners are
used to defining variables before use; so this would eliminate one
source of confusion about scope as illustrated above.