[r6rs-discuss] [Formal] defer lambda rather than define rhs when expanding body
On Mar 11, 2007, at 5:30 PM, Per Bothner wrote:
> * It improves consistency. Consider:
>
> #|1|# (define VAR (MAC))
> #|2|# (set! VAR (MAC))
> #|3|# (list (MAC))
> #|4|# (MAC)
> #|5|# (define VAR (lambda () (MAC)))
> #|6|# (set! VAR (lambda () (MAC)))
> #|7|# (define-syntax MAC ...)
>
> Which of #1-#6 are valid when followed by #7?
> By my reading only #1 and #5 are allowed. But that doesn't seem
> natural
> to me. If #5 is allowed, then #6 should be allowed.
> Similarly for #1 and #2.
Since #7 is a definition, it cannot come after an expression.
Consequently,
#2, #3, and #6 are not allowed after define-syntax, and this properly
has
nothing to do with whether expanding the body of a lambda is deferred
or not.
So, #1 and #5 are allowed because they are definitions and therefore can
appear with other definitions. The occurrence of MAC is a red herring
because the exact same answer can be given for:
#1# (define VAR 1)
#2# (set! VAR 1)
#3# (list 1)
#4# (MAC)
#5# (define VAR (lambda () 1))
#6# (set! VAR (lambda () 1))
#7# (define-syntax MAC ...)
Aziz,,,
Received on Sun Mar 11 2007 - 22:49:23 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC