unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Rock <rocco.rossi@gmail.com>
To: guile-user@gnu.org
Subject: Guile 1.9 series, unquote and unquote-splicing not up-to-date.
Date: Tue, 14 Dec 2010 17:39:22 +0100	[thread overview]
Message-ID: <AANLkTinRiSJMDMJPM8ffR1yyPSOEiwqefBuMoK7yYT+2@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2010-12-14 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 16:39 Rock [this message]
2011-02-08 20:41 ` Guile 1.9 series, unquote and unquote-splicing not up-to-date Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinRiSJMDMJPM8ffR1yyPSOEiwqefBuMoK7yYT+2@mail.gmail.com \
    --to=rocco.rossi@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).