[racket-dev] OT: stump misunderstands Scheme?

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Tue Nov 16 17:17:21 EST 2010

Though also cycle back to us.  I'm curious to hear what he has to say.


On Tue, Nov 16, 2010 at 5:13 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> That expression at the end is somehow turning a procedure back into
> its quoted form. I have no idea if a Scheme that did that would be R5
> or not, but Racket definitely does not allow that (and neither did any
> other programming language that I've ever worked on).
> Overall, I'd say, you should contact Aaron directly, instead of asking here.
> Robby
> On Tue, Nov 16, 2010 at 4:07 PM, John Clements
> <clements at brinckerhoff.org> wrote:
>> 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,
>> John
>> 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))
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/dev
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev

Posted on the dev mailing list.