unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Guile 1.9 series, unquote and unquote-splicing not up-to-date.
@ 2010-12-14 16:39 Rock
  2011-02-08 20:41 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Rock @ 2010-12-14 16:39 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 1961 bytes --]

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: rocco.rossi@gmail.com
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)

[-- Attachment #2: Type: text/html, Size: 3295 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Guile 1.9 series, unquote and unquote-splicing not up-to-date.
  2010-12-14 16:39 Guile 1.9 series, unquote and unquote-splicing not up-to-date Rock
@ 2011-02-08 20:41 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2011-02-08 20:41 UTC (permalink / raw)
  To: Rock; +Cc: guile-user

On Tue 14 Dec 2010 17:39, Rock <rocco.rossi@gmail.com> writes:

> unquote (and unquote-splicing as well) cannot be applied to multiple
> expressions.

Ah, interesting.  I had not noticed this feature.

Turns out this was easy to fix, I just imported upstream psyntax's
quasiquote definition.  Pushed to git.  Thanks for the report!

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-08 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-14 16:39 Guile 1.9 series, unquote and unquote-splicing not up-to-date Rock
2011-02-08 20:41 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).