Email list hosting service & mailing list manager

Problem of implicit quasiquote Shiro Kawai (27 Jun 2020 18:08 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (27 Jun 2020 20:54 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 02:09 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 02:10 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (28 Jun 2020 08:14 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 09:34 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (28 Jun 2020 10:34 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 11:00 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 11:16 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (28 Jun 2020 12:50 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 20:45 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (28 Jun 2020 21:01 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 21:08 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (28 Jun 2020 21:14 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 21:42 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (28 Jun 2020 21:52 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (29 Jun 2020 06:31 UTC)
Re: Problem of implicit quasiquote Shiro Kawai (29 Jun 2020 20:27 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (30 Jun 2020 13:11 UTC)
Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen (04 Jul 2020 09:09 UTC)

Re: Problem of implicit quasiquote Marc Nieper-Wißkirchen 28 Jun 2020 10:34 UTC

Am So., 28. Juni 2020 um 11:34 Uhr schrieb Shiro Kawai <xxxxxx@gmail.com>:

> Ah right!   It was too easy.  I remember the real issue I had when I was dealing with nested unquotes with implicit quasiquote.

I think everything boils down how to insert literal unquotes into the
output of a quasiquotation.  Given an expression X, what is the
quasiquote template that evaluates to the evaluation of (list 'unquote
X).

The canonical template for this seems to be:

(,'unquote ,x)

Again, we don't need any explicit list constructors.

> If quasiquotes and quotes are always paired up, you have a canonical rule to deal with nested quasiquote, even the meaning of quasiquote may change by surrounding macros, as long as other macros follow the same rule---the outermost quasiquote corresponds to the innermost unquote.  Implicit quasiquote breaks the canonicality, and it seems to me a too high price to pay to save just one character.

We can extend the canonical rule. Whenever you want to insert an
unquote or unquote splicing without a matching quasiquote in the
output, just use ,'unquote.

This may not be as pretty as ,,x, but this is due to the choice of the
qq template engine. It shouldn't dictate the form of macros. There are
a lot of meaningful syntaxes where "raw" commas appear. A qq template
(at some depth) is actually one. :)

That said, for the generation of Scheme syntax one shouldn't use qq
anyway if one is not forced to do because maintaining source location
information will be hard or impossible. The syntax form is made
especially for this and is much clearer anyway:

(define-syntax gen-match
  (lambda (stx)
    (syntax-case stx ()
      ((_ name x input)
       #'(match input ((name ,x ,y) `(,x ,y)) (_ #f))))))

(Of course, this is essentially a syntax-rules macro.)