[Top][All Lists]

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

Re: A protest against pcase, pcase-let, pcase-let*

From: Dmitry Gutov
Subject: Re: A protest against pcase, pcase-let, pcase-let*
Date: Tue, 31 Mar 2015 22:25:30 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Thunderbird/36.0

On 03/31/2015 09:00 PM, Alan Mackenzie wrote:

OK, maybe pcase itself has a page in the elisp manual, but this page is
very difficult to understand, certainly for me.  I have attempted quite
a lot of times to make sense of it, and failed.

I think it's pretty nice. It provides pattern matching, as well as destructuring (something that previously required the use of cl-lib), in a concise and performant way.

The docs can look a bit dense at first, but after reading them carefully and experimenting a bit, I'm sure most people can get a hang of it.

There are two possibilities here: (i) the page is difficult because
pcase is itself difficult.

It's not trivial. Pattern matching is, usually, a feature of more advanced programming languages. But that doesn't mean we shouldn't use it.

pcase-let and pcase-let* are totally absent from the elisp manual.
Their doc strings say nothing more than "Like `let' but where you can
use `pcase' patterns for bindings.", without giving any clue as to what
"`pcase' patterns" are, or what the syntax and semantics of their
"use" of them for bindings look like.

`pcase' patterns are described in the `pcase' docstring, and in the manual entry for it.

The semantics of use of them for bindings should be pretty apparent after you understand how to use `pcase' itself.

As an aside, I suspect that edebug will not be useful in (possibly
large) uses of these forms, given that they are implemented as macros
rather than special forms.

It worked well when I tried it.

reply via email to

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