guile-user
[Top][All Lists]
Advanced

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

Guile 1.9 series, unquote and unquote-splicing not up-to-date.


From: Rock
Subject: Guile 1.9 series, unquote and unquote-splicing not up-to-date.
Date: Tue, 14 Dec 2010 17:39:22 +0100

I've just verified that the implementations of unquote and unquote-splicing in Guile do not conform to R6RS. Perhaps this is intentional, but it would be a shame because the change in R6RS is certainly one for the better. Scheme's quasiquotation is defined very well (it's even used as a reference in Common Lisp's backquote definition) but ... it did have a major drawback.

unquote (and unquote-splicing as well) cannot be applied to multiple expressions. This messes things up a little, especially when you're dealing with nested quasiquotations. Anyway, you can't do things like this (like you can in CL and R6RS):

(let ((name 'foo))
  `((unquote name name name)))
                => (foo foo foo)

But the latter example is nothing. You can get around it in a second. There are however MUCH worse-case scenarios which, quite possibly, cannot be worked around (or at most with ugly solutions).
The current rules for evaluation are (from R6RS):

If an (unquote <_expression_> ...) form appears inside a <qq template>, however, the <_expression_>s are evaluated (“unquoted”) and their results are inserted into the structure instead of the unquote form.

If an (unquote-splicing <_expression_> ...) form appears inside a <qq template>, then the <_expression_>s must evaluate to lists; the opening and closing parentheses of the lists are then “stripped away” and the elements of the lists are inserted in place of the unquote-splicing form.

Any unquote-splicing or multi-operand unquote form must appear only within a list or vector <qq template>.

That just about says it all. Alan Bawden discussed the previous flaw in Scheme. Now it's cured. Hope to see the new rules in Guile too.


--
Rocco Rossi

E-Mail: address@hidden
Profilo: http://www.google.com/profiles/rocco.rossi

"Sono nato senza conoscere nulla e ho avuto un po' di tempo per cambiare qua e là questa mia condizione." (Richard P. Feynman)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]