Subject: bug#20636: 24.5; pcase: nil should be an UPattern

From: Philipp Stephani <[email-masked]>
Date: Sun, 24 May 2015 11:00:03 +0000

Johan Bockgård <[email-masked]> schrieb am So., 24. Mai 2015 um 02:27 Uhr:

> Philipp Stephani <[email-masked]> writes:
>
> > The pcase help says that SELFQUOTING is a UPattern.  This works for
> > e.g. t
>
> Actually, t is not self-matching; it is equivalent to _ (match
> anything). But this "feature" seems to be undocumented.
>
>
Thanks, I really wasn't aware of that! nil and t should work as QPatterns
(they are atoms), but the documentation about UPatterns seems less clear.
Specifically, 'self-quoting' doesn't seem to be an established or widely
known term.  The Elisp manual talks about 'self-evaluating forms' (anything
that is not a list or symbol), but 'self-quoting' in the `pcase' sense
seems to be a more comprehensive construct as it also includes keywords.
The Elisp manual talks about 'symbols acting like self-evaluating-forms' in
the following paragraph:

   The symbols `nil' and `t' are treated specially, so that the value
of `nil' is always `nil', and the value of `t' is always `t'; you
cannot set or bind them to any other values.  Thus, these two symbols
act like self-evaluating forms, even though `eval' treats them like any
other symbol.  A symbol whose name starts with `:' also self-evaluates
in the same way; likewise, its value ordinarily cannot be changed.

So this definition includes both keywords and nil and t. Ideally,
'self-quoting' in the pcase sense would have the same meaning (right now it
includes keywords but not nil or t). The documentation should really
enumerate all the forms exhaustively to make the definitions clearer.