bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#31311: 27.0; doc of `pcase'


From: Thien-Thi Nguyen
Subject: bug#31311: 27.0; doc of `pcase'
Date: Tue, 15 May 2018 16:24:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

() Michael Heerdegen <michael_heerdegen@web.de>
() Sat, 12 May 2018 15:54:18 +0200

   >   a.  (pcase t   ('t   'true))  => true
   >   b.  (pcase nil ('nil 'false)) => false
   >   c.  (pcase t   (t    'true))  => true
   >   d.  (pcase nil (nil  'false)) |= ERROR: Unknown pattern ‘nil’

   That's all correct and intended - see 3ef31167.  t was
   originally intended as catchall pattern equivalent to _ but
   has been deprecated (since it was confusing).  Try e.g.

     (pcase nil
      (t t))

   You get a message when you use it, but when evaluating and
   not when compiling (so you must look in the *Messages* buffer
   - I don't think this is intended...).  A catch-nothing
   pattern is not useful, so nil is just invalid.

Thanks.  I've added a blurb suggesting to avoid both ‘t’ and
‘nil’ (commit 5fc0f24c).  Here's the text:

 Two symbols to avoid are @code{t}, which behaves like @code{_}
 (above) and is deprecated, and @code{nil}, which signals error.
 It makes no sense to bind these (@pxref{Constant Variables}).

This is in the table, part of the @var{symbol} entry.

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502

Attachment: signature.asc
Description: PGP signature


reply via email to

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