[racket-dev] Fwd: Q. about "Directly Reflective" paper

From: John Clements (clements at brinckerhoff.org)
Date: Wed Nov 17 00:41:24 EST 2010

Well, he's generous about it; here's what he had to say.

John


Begin forwarded message:

> From: Aaron Stump <aaron-stump at uiowa.edu>
> Date: November 16, 2010 5:58:42 PM PST
> To: John Clements <clements at brinckerhoff.org>
> Subject: Re: Q. about "Directly Reflective" paper
> Reply-To: astump at cs.uiowa.edu
> 
> Hi, John.
> 
> I think you are right about this.  Lambda abstractions evaluate to #procedures in Scheme R5RS, and so it is not possible to take a cdr or car of one of these.  I have no idea why I wrote this (four years ago -- there was a major lag between acceptance and publication at HOSC).  I will add a note to my web page about this, and possibly upload a revised version of the paper without this incorrect statement.
> 
> Aaron
> 
> On Tue, Nov 16, 2010 at 4:18 PM, John Clements <clements at brinckerhoff.org> wrote:
> I'm reading your paper, "Directly Reflective Meta-Programming," and I got stuck early on a remark of yours about Scheme:
> 
> > 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))
> 
> 
> This looks pretty goofy to me.  Do you know of R5RS implementations that actually allow you to peel apart a 3d value like this?  Racket (nee MzScheme) certainly doesn't.
> 
> Thanks!
> 
> 
> John Clements
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20101116/e0352d4d/attachment.html>
-------------- 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/e0352d4d/attachment.p7s>

Posted on the dev mailing list.