emacs-devel
[Top][All Lists]
Advanced

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

pcase: Semantics of atom QPATS


From: Michael Heerdegen
Subject: pcase: Semantics of atom QPATS
Date: Sun, 10 Jun 2018 02:40:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Hello,

isn't it strange that the pattern '.7 matches .7, but `.7 causes an
error when used?

Or

(pcase '(.7 1)
  ('(.7 1) t))
==> t

but

(pcase '(.7 1)
  (`(.7 ,_) t))
|-- error: `--pcase-macroexpander: Unknown QPAT: 0.7

IMO the analogy to the list of self-quoting atoms (strings, keywords,
integers - I'm all for that) is misguided here - something implicitly
quoted in a backquoted pattern (i.e. something that is not unquoted)
should behave like quoted with `'' (i.e. transformed into an `eq' test),
everything else feels inconsistent.

This corner case actually bit me when I was trying to refactor a piece
of code that included the atom .7 (as you might have guessed) with
el-search.


Thanks,

Michael.



reply via email to

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