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: Daimrod
Subject: bug#16567: 24.3.50; pcase should signal an error if no case matches
Date: Mon, 27 Jan 2014 13:23:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Helmut Eller <address@hidden> writes:

> On Mon, Jan 27 2014, Daimrod wrote:
>
>> Helmut Eller <address@hidden> writes:
>>
>>> 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.
>>
>> Wouldn't a `epcase' (as in `cl-ecase') be more appropriate for this
>> use-case?
>
> My gut feeling is that in 80% of all situations ECASE is more or just as
> appropriate as CASE.  Or put differently it's very uncommon that CASE is
> preferable to ECASE.  Therefore I think pcase should singal an error by
> default.
>
> The nice thing about a epcase would be the symmetry/analogy to
> ECASE/ETYPECASE.  But that seems like a minor advantage.

It also has the advantage of not breaking existing code that relies on
its current behavior, though I agree that most of the time I use ECASE
instead of CASE.

> Helmut

-- 
Daimrod/Greg





reply via email to

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