On Fri, May 6, 2011 at 11:25 AM, Andrzej
<ndrwrdck@x> wrote:
(let ((unquote apply))
`((unquote + (list 1 2)))) => ((unquote + (list 1 2))) ; plt-scheme
(R6RS mode) (1)
(let ((unquote apply))
`((unquote + (list 1 2)))) => (#<procedure:+> (1 2)) ; isn't it a
desired output (because of referential transparency)? (2)
(let ((unquote apply))
`((unquote + (list 1 2)))) => ((apply + (list 1 2))) ; or this
(because of macro hygiene)? (3)
After all we can rebind anything else just fine:
(let ((+ -))
`((unquote + (list 1 2)))) => (#<procedure:-> (1 2))
> ...which makes the most sense to me.
Can you explain why is this a desirable output? I'm just wondering if
this is a subtle bug in plt-scheme, my lack of understanding of R6RS
or an inherent issue with it.
After all the discussion in this thread I'm in favor of (3) (which
essentially means that UNQUOTE being an identifier). (2) would be the
behavior with keywords being matched by name. (1) is somewhere in
between.
Your (3) is close, but the rationalization:
After all we can rebind anything else just fine:
(let ((+ -))
`((unquote + (list 1 2)))) => (#<procedure:-> (1 2))
is unfair, because this example gives UNQUOTE its special meaning (to QUASIQUOTE) back. A better example would be:
(let ((+ -))
`((not-so-unquote + (list 1 2))))
Can we agree that this does *not* evaluate to '((not-unquote #<procedure:-> (1 2))) ?
In your (3), you I infer you recognize that UNQUOTE has lost its special meaning to QUASIQUOTE due to the local binding. But the value of the binding is irrelevant. To QUASIQUOTE it just becomes another unrecognized identifier to be copied through.