[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quasiquote limit cases
| Subject: Re: quasiquote limit cases
| From: Jim Blandy <jimb@red-bean.com>
| Date: 22 Mar 1998 21:20:57 -0500
|
|
| > R5RS says:
| > ... If no commas appear within the <template>, the result of
| > evaluating `<template> is equivalent to the result of evaluating
| > '<template>.
|
| The intent was clear to me, but I think this is misleading because it
| says that the *results* are equivalent; the results are values, and
| thus it's reasonable to wonder about which definition of value
| equivalence the authors meant.
|
| I suggest:
|
| If no commas appear within the <template>, the expression
| `<template> is equivalent to the expression '<template>.
|
| It's shorter, and it's clear that one is discussing the equivalence of
| expressions: equivalence of effect and value.
I actually wonder about this. I make a distinction between quote and
backquote even in such cases.
When I use quote, I am stating that I will not mutate the object, and that
I may depend on its uniqueness -- i.e. no copying.
When I use backquote, I make no such statement. In fact, I use it to
create a list initialized with constants that I am willing to mutate.
Thus I think of
`(a b c)
as equivalent to
(list 'a 'b 'c)
while
'(a b c)
is more like
;; at top level
(define <hidden-variable> (list 'a 'b 'c))
;; at use
<hidden-variable>
I realize that the reports don't allow me to make that assumption, but
I wonder whether backquote might not be more useful if they did.
This distinction implies deep copying of back-quoted structure. When
actual insertion is desired, the following clumsy but clear idiom
can be used
`(foo ,bar ,@'(joe mary frederick))