emacs-devel
[Top][All Lists]
Advanced

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

Re: Instead of pcase


From: Emanuel Berg
Subject: Re: Instead of pcase
Date: Thu, 16 Nov 2023 19:11:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Richard Stallman wrote:

> `pcase' is a big and unnecessary complication on Emacs Lisp.
> I think its presence worse overall.
>
> One can easily think of `pcase' as "just another feature",
> like each of the thousands of other predefined functions and
> macros in Emacs Lisp. But that picture is incorrect for
> `pcase', because it does not count the cost of `pcase'
> in complexity.

There are, according to the below code [last], 13 011 hits for
cl-lib in the Emacs source. For pcase, there are 2168.
So there is no kicking that out either. But regardless of
whatever, here is the use of pcase,

   1525 pcase
    189 pcase-let
    137 pcase-dolist
     95 pcase-let*
     43 pcase-lambda
     35 pcase-exhaustive
     27 pcase-defmacro
     26 pcase-tests
     20 pcase-setq
     19 pcase-macroexpander
     10 pcase-vars
      7 pcase-patterns
      6 pcase-expand
      5 pcase-transform
      5 pcase-mutually
      4 pcase-bindings
      3 pcase-memoize
      3 pcase-compile
      2 pcase-used
      2 pcase-slot
      2 pcase-map
      1 pcase-matches
      1 pcase-default
      1 pcase-bug
Total: 2168

> Those of you who are fans of `pcase' may not recognize the
> cost it imposes on the Emacs Lisp language. You paid that
> cost already, perhaps a few years ago, and perhaps you enjoy
> each new language construct you learn. Perhaps, for you, the
> more complexity of features to be learned, the better.

Yes, I think a lot of people will say pcase is interesting.
But a lot of people will say it is very useful as well, and
they will disagree it places any kind of burden on anything.

In the case of pcase actually, with its pattern matching
feature, I think a lot of people will say, if anything, it
makes the code more light.

#! /bin/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/emacs

clp () {
    cd ~/src/emacs
    local re='pcase|pcase-[a-z0-9*]+'
    grep -E -h -o -w  $re **/*.el | sort | uniq -c | sort -b -n -r
    echo 'Total:' $(grep -E -h -o -w $re **/*.el | wc -l)
}

cle () {
    cd ~/src/emacs
    local re='cl-[a-z0-9*]+'
    grep -E -h -o -w $re **/*.el | sort | uniq -c | sort -b -n -r | head -n 100
    echo 'Total:' $(grep -E -h -o -w $re **/*.el | wc -l)
}

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
1.16.0) of 2023-11-01 [commit
8eb9b82ce58a8323af21f52625a401e19e279a9c]

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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