[Top][All Lists]

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

syntax taste: use of unquote in macros

From: Matt Wette
Subject: syntax taste: use of unquote in macros
Date: Sun, 29 Mar 2020 08:11:12 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Hi All,

I'm not sure if you know about this, but there is a discrepancy in the
way some folks define macros to use unquote (aka ,).   For example,

> (use-modules (system base pmatch))
> (pmatch '(foo "bar")  ((foo ,val)  (write val) (newline)))
=> "bar"

> (use-modules (ice-9 match))
> (match '(foo "bar")  (`(foo ,val)  (write val) (newline)))
=> "bar"

Note the difference in the use of quasiquote (aka `) in the pattern
for (foo ,val): match syntax uses it, pmatch does not.
In Scheme, quasiquote and unquote always come together.

Is pmatch syntax in bad taste?  I'm looking for opinions.

Another example is sxml-match, which omits use of quasiquote.
I have written a variation of sxml-match.  Should I keep the sxml-match
usage, which keeps it compatible with sxml-match,  or adopt that
used by (ice-9 match)?


reply via email to

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