[racket-dev] OT: stump misunderstands Scheme?

From: John Clements (clements at brinckerhoff.org)
Date: Tue Nov 16 17:07:25 EST 2010

I'm reading Aaron Stump's "Directly Reflective Meta-Programming," and it appears to me that either he misunderstands Scheme, or that I misunderstand it. Are there many Scheme dialects in which his use of quasiquote to embed a 3d value would successfully pry open the syntactic term?

(Excerpt below)

Sorry for the OT post,


2.1.2	Variables in Meta-Programming

A meta-programming language is scope safe (or hygienic) iff variables may not be captured or escape their scopes during computation. Dynamic variables in Emacs LISP and Common LISP are a good example of a violation of scope safety [30, 24]. Scheme R5RS’s macro language is designed to be scope safe [21]. Other constructs in Scheme R5RS, however, enable violation of scope safety, even though the language does not have dynamic variables. For a violation of scope safety in spirit, though not technically, we have that (caddr ’(lambda (x) x)) evaluates to x. According to the R5RS language definition, ’(lambda (x) x) is a literal expression, and hence the occurrences of x in it are not variables at all, but just (unscoped) literal data. So in this example, a variable has been created (namely, the resulting unquoted x), but not by means of removing it from its scope. Using quasiquotation, however, the example may be modified to give a true violation of scope safety. The following expression extracts the variable x from its scope, by transforming the binding lambda expression into a piece of literal data, and then extracting and evaluating the quoted variable.

((lambda (y) (eval ‘(car (cdr (cdr ’,y))))) (lambda (x) x))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4669 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20101116/7785dafb/attachment.p7s>

Posted on the dev mailing list.