unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: 16567@debbugs.gnu.org
Subject: bug#16567: 24.3.50; pcase should signal an error if no case matches
Date: Mon, 27 Jan 2014 13:23:30 +0100	[thread overview]
Message-ID: <877g9ly5od.fsf@tanger.home> (raw)
In-Reply-To: <m24n4pabah.fsf@gmail.com> (Helmut Eller's message of "Mon, 27 Jan 2014 12:56:06 +0100")

Helmut Eller <eller.helmut@gmail.com> writes:

> On Mon, Jan 27 2014, Daimrod wrote:
>
>> Helmut Eller <eller.helmut@gmail.com> 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	other threads:[~2014-01-27 12:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27  9:22 bug#16567: 24.3.50; pcase should signal an error if no case matches Helmut Eller
2014-01-27 10:27 ` Daimrod
2014-01-27 11:56   ` Helmut Eller
2014-01-27 12:23     ` Daimrod [this message]
2014-09-08 18:27 ` Leo Liu
2014-09-08 19:19 ` Stefan Monnier
2014-09-08 20:58   ` Helmut Eller
2014-09-09  0:41     ` Stefan Monnier
2014-09-10  0:02       ` Leo Liu
2014-09-10  2:26         ` Stefan Monnier
2014-09-10  2:52           ` Leo Liu
2014-09-10  5:32             ` Josh
2014-09-10  6:18               ` Helmut Eller
2014-09-10 13:17             ` Stefan Monnier
2014-09-10 14:28               ` Helmut Eller
2014-09-10 17:26                 ` Stefan Monnier
2014-09-10 14:33               ` Leo Liu
2014-09-10 16:54               ` Glenn Morris
2014-09-10 17:54                 ` Stefan Monnier
2014-09-12  2:35                   ` Leo Liu
2014-09-12 17:15                     ` Stefan Monnier
2014-09-13  0:29                       ` Leo Liu
2014-09-13  3:10                         ` Stefan Monnier
2014-09-13  4:57                           ` Leo Liu
2014-09-13 15:01                             ` Stefan Monnier
2014-09-13 17:25                               ` Leo Liu
2014-09-10 17:39               ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877g9ly5od.fsf@tanger.home \
    --to=daimrod@gmail.com \
    --cc=16567@debbugs.gnu.org \
    --cc=eller.helmut@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).