emacs-devel
[Top][All Lists]
Advanced

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

Re: Instead of pcase


From: Eli Zaretskii
Subject: Re: Instead of pcase
Date: Thu, 16 Nov 2023 21:19:48 +0200

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Thu, 16 Nov 2023 18:44:10 +0100
> 
> "T.V Raman" <raman@google.com> writes:
> 
> > I recently tried to understand some of the completion code; --
> > specifically, completion-at-point, and immediately hit the pcase wall
> > and gave up --- my lack of understanding of pcase made that code in
> > Emacs Core read like line-noise.
> 
> But that pcase form is only performing trivial destructuring.

If it does, then the node "Destructuring with pcase Patterns" Needs
Work™, because if you try to compare this fragment from
completion-at-point:

    (pcase res
      (`(,_ . ,(and (pred functionp) f)) (funcall f))
      (`(,hookfun . (,start ,end ,collection . ,plist))

with the example in the manual that explains destructuring, viz.:

       (pcase my-list
         (`(add ,x ,y)  (message "Contains %S and %S" x y)))

you will, I hope, see the difficulty of a newcomer to 'pcase' in
understanding how the code in completion-at-point is "only
destructuring".  IOW, if this code is "just destructuring", we don't
do a good-enough job of explaining that in the manual.



reply via email to

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