[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: KenD@apple.com*Subject*: Re: quasiquotation semantics*From*: Matthias Blume <blume@hip.atr.co.jp>*Date*: Tue, 08 Aug 1995 10:23:57 +0900*Cc*: feeley@iro.umontreal.ca, rrrs-authors@martigny.ai.mit.edu, ebg@hip.atr.co.jp*In-Reply-To*: Your message of "Mon, 7 Aug 1995 11:55:19 -0700"*References*: <9508071853.AA16479@aruba.apple.com>*Reply-To*: blume@cs.Princeton.EDU

From: KenD@apple.com (Ken Dickey) Subject: Re: quasiquotation semantics Date: Mon, 7 Aug 1995 11:55:19 -0700 > At 12:33 PM 95/08/7 -0400, Marc Feeley wrote: > >Suppose I write the following quasiquote expression: `(a ,X b ,Y) > > > >Is it equivalent to: > > (list 'a X 'b Y) > >or > > (cons 'a (cons X (cons 'b (cons Y '())))) > > In implementations I am familiar with, the second, explicit cons, form is > always used. > > Another interpretation is (roughly): > > (let ( (temp (cons 'a (cons #f (cons 'b (cons #f '())))) ) ) > (setf (cadr temp) X) > (setf (caddr temp Y) > temp > ) > > where temp is shared amoung all invocations of the quasiquoted form, but I > don't know of any implementations which do this. > > If we standardize something we should use the most common implementation > (perhaps JARs?). > > Cheers, > -Ken > > I'm not sure I understand your worries. Probably you are referring to the fact that the explicitely-CONSed list will be _partially_ reconstructed if we jump into the middle of the expression, while the LISTed form will reconstruct the _entire_ expression. This is indeed bad, because in Scheme we can observe the difference (EQ?). But I wouldn't go so far and blame quasiquote, call/cc, cons, or list for that; I blame the very concept of EQ?-ness of cons cells. If that wouldn't be in the language, then this particular problem wouldn't exist, because it would be impossible to observe the difference. Scheme has *way* too many effects, nearly _everything_ has some sort of effect, which inhibits a great deal of very useful optimizations without being very useful in itself. It is a shame that ((lambda (x y) (cons x (cons y '()))) X Y) cannot be beta-reduced to (cons X (cons Y '())) only because EQ? could observe the difference between the two. However, all this is only one part of the problem. If X and Y in `(,X ,Y) can be arbitrary expressions with effects, then the result is already undefined, since Scheme doesn't specify the order of argument evaluation. (list X Y) and (cons X (cons Y '())) suffer from the same problem here. -Matthias PS: Ken's alternative `solution' above is incorrect (IMO). Not only does it try to solve a problem which has its roots in the pervasiveness of effects by introducing even more effects, it also breaks the semantics of quasiquote. The latter isn't very well formalized (witness the current thread), but the Scheme report does say somewhere that quasiquote is "equivalent" to some sequence of CONS, LIST, APPEND, VECTOR etc. calls. No data mutation here. In Ken's proposed solution you could use call/cc to modify a quasiquote-constructed data item by jumping into the middle of its creation.

**References**:**Re: quasiquotation semantics***From:*KenD@apple.com (Ken Dickey)

- Prev by Date:
**Re: quasiquotation semantics** - Next by Date:
**Proposal for exception handling** - Prev by thread:
**Re: quasiquotation semantics** - Next by thread:
**Proposal for exception handling** - Index(es):