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: Phillip Lord
Subject: Re: The poor state of documentation of pcase like things.
Date: Sat, 19 Dec 2015 19:29:22 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> Michael Heerdegen <address@hidden> writes:
>
>> As far as I understand how Stefan used to work, most of the semantics of
>> most of the pcase derivatives, like `pcase-let', are not yet 100% fixed,
>> we are not yet sure how useful we are, or if they may later be better be
>> replaced by other forms that are more general, etc.
>
> BTW3, we were not yet all agreed how the semantics of `pcase-dolist'
> should be when the pattern doesn't match (currently, AFAIK, it loops
> nonetheless).  Similarly for pcase-let and pcase-lambda.  For some of
> these forms, we do not yet know how useful they are.

pcase-lambda seems useful to me, seems to only take a single pattern,
like so:

(funcall
 (pcase-lambda (`(,x ,y))
   y)
 '(1 2))

To me, it would be more useful if it supported multiple patterns.

(funcall
 (pcase-lambda
    ((1)
      (message "Is a one"))
    (`(,_)
      (message "is a list")))
 1)

The non-matching situation would then be in the hands of the user. Or it
would be possible to make a "pcase-lambda-exhaustive" macro (probably
with a better name".

I'd also rename "pcase.el" to "p.el" but hey, that's a different story.


    
> Just some examples of open questions that shows that some stuff is still
> a bit of work in progress.


One that's already getting quite a bit of use.

Phil



reply via email to

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