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

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

bug#70597: closed (Problem in pcase-let?)


From: GNU bug Tracking System
Subject: bug#70597: closed (Problem in pcase-let?)
Date: Sat, 04 May 2024 11:37:02 +0000

Your message dated Sat, 04 May 2024 14:35:43 +0300
with message-id <861q6hhks0.fsf@gnu.org>
and subject line Re: bug#70597: Problem in pcase-let?
has caused the debbugs.gnu.org bug report #70597,
regarding Problem in pcase-let?
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
70597: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70597
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Problem in pcase-let? Date: Fri, 26 Apr 2024 20:00:02 +0200
Hi

This is for GNU Emacs 29.2 (build 2, x86_64-w64-mingw32) of 2024-02-01 running on Windows 11.

I just noticed the following with pcase-let and pcase.  I believe this is a problem with pcase-let.  The following is a IELM transcript.  The second plet-case should, IMHO, fail.

ELISP> (pcase-let ((`(let ,bs (when ,c . ,r)) '(let ((foo 42)) (when 1 2 3))))
         (list 'bs bs 'c c 'r r))
(bs
 ((foo 42))
 c 1 r
 (2 3))

ELISP> (pcase-let ((`(let ,bs (when ,c . ,r)) '(let ((foo 42)) (zot 1 2 3))))
         (list 'bs bs 'c c 'r r))
(bs
 ((foo 42))
 c 1 r
 (2 3))

ELISP> (pcase '(let ((foo 42)) (when 1 2 3))
         (`(let ,bs (zot ,c . ,r)) (list 'bs bs 'c c 'r r)))
nil

pcase correctly fails to match when and zot, while pcase-let seems to happily go ahead.

All the best

--
Marco Antoniotti
Somewhere over the Rainbow

--- End Message ---
--- Begin Message --- Subject: Re: bug#70597: Problem in pcase-let? Date: Sat, 04 May 2024 14:35:43 +0300
> From: Marco Antoniotti <marcoxa@gmail.com>
> Date: Thu, 2 May 2024 13:06:58 +0200
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, brubar.cs@gmail.com, 
> 70597@debbugs.gnu.org
> 
> it's your call.  But please change the doc string to clarify that pcase-let 
> does not do "symbol equality" pattern
> matching, but only structural matching.  Adding an example like the following 
> will help.
> 
> (pcase-let ((`(foo ,x 23 ,y) '(bar 11 baz 22))) (list x y))

This is already explained in the ELisp manual, and the doc string
already says

  Each EXP should match its respective PATTERN (i.e. be of structure
  compatible to PATTERN)

So I don't think we need to do anything else here, and I'm closing
this bug.


--- End Message ---

reply via email to

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