emacs-devel
[Top][All Lists]
Advanced

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

Re: The poor state of documentation of pcase like things.


From: Dmitry Gutov
Subject: Re: The poor state of documentation of pcase like things.
Date: Sun, 3 Jan 2016 03:21:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Thunderbird/43.0

On 01/03/2016 03:07 AM, Lars Magne Ingebrigtsen wrote:

The only way you'll know whether `status-symbol' is really a symbol, and
all the cases are really symbols, is by reading the entire thing.  The
44th case could have been (_ foo bar zot), for instance.

How is that different from cond? If I have cond like this:

(cond
 ((eq status-symbol 'unauthorized)
  (url-http-handle-authentication nil))
 ((eq status-symbol 'payment-required)
  (url-mark-buffer-as-dead buffer)
  (error "Somebody wants you to give them money"))
 ...)

...you'll also have to read until its end to find out for sure whether the variable name lies or not:

(cond
 ((eq status-symbol 'unauthorized)
  (url-http-handle-authentication nil))
 ((eq status-symbol 'payment-required)
  (url-mark-buffer-as-dead buffer)
  (error "Somebody wants you to give them money"))
 ((memq 'zomg status-symbol)
  (give-away all-moneys)))

In Common Lisp, you'd say

cl-case is more restricted, yes, but I thought this discussion was about how pcase is worse than cond.

I kinda liked pcase at first, but the more I see of the pcase language,
the more sceptical I get.  I'm beginning to wonder whether the whole
thing is a misfeature that should be replaced with several separate
operators.

You mean pattern matching? A lot of language and library designers would disagree with you.



reply via email to

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