bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16567: 24.3.50; pcase should signal an error if no case matches


From: Helmut Eller
Subject: bug#16567: 24.3.50; pcase should signal an error if no case matches
Date: Mon, 08 Sep 2014 22:58:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

On Mon, Sep 08 2014, Stefan Monnier wrote:

>> pcase returns nil for this example:
>>  (pcase 3
>>    (1 1)
>>    (2 2))
>> it would be more useful if it would signal an error instead.  Manually
>> adding a "catch-all case" and inventing some error message is tedious
>> and it's also easy to forget.
>
> The "nil default" is also very handy at times and pcase has been in use
> for long enough that we can't really change this easily.

What could happen if you would change it?  Mostly some "no clause
matching" errors.  Arguably better than the current situation where
poeple forget the unintuitive default and receive no error message.

> But we could add a new pcase-exhaustive macro that does that.

Nobody wants to use such a long name.  The "nil default" would make more
sense in a pcase-if or pif macro.

Helmut





reply via email to

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