From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daimrod Newsgroups: gmane.emacs.bugs Subject: bug#16567: 24.3.50; pcase should signal an error if no case matches Date: Mon, 27 Jan 2014 13:23:30 +0100 Message-ID: <877g9ly5od.fsf@tanger.home> References: <877g9lzpm9.fsf@tanger.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1390824916 12658 80.91.229.3 (27 Jan 2014 12:15:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jan 2014 12:15:16 +0000 (UTC) Cc: 16567@debbugs.gnu.org To: Helmut Eller Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 27 13:15:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W7l60-00044T-Pe for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jan 2014 13:15:20 +0100 Original-Received: from localhost ([::1]:59148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7l5z-0007aJ-TP for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jan 2014 07:15:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7l5p-0007a0-Ee for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 07:15:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7l5i-00036A-4m for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 07:15:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7l5i-00035Y-0x for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 07:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W7l5h-00041h-Kh for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 07:15:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daimrod Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Jan 2014 12:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16567 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16567-submit@debbugs.gnu.org id=B16567.139082484615407 (code B ref 16567); Mon, 27 Jan 2014 12:15:01 +0000 Original-Received: (at 16567) by debbugs.gnu.org; 27 Jan 2014 12:14:06 +0000 Original-Received: from localhost ([127.0.0.1]:37472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7l4o-00040R-Cq for submit@debbugs.gnu.org; Mon, 27 Jan 2014 07:14:06 -0500 Original-Received: from mail-wg0-f51.google.com ([74.125.82.51]:54802) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7l4m-00040I-9j for 16567@debbugs.gnu.org; Mon, 27 Jan 2014 07:14:04 -0500 Original-Received: by mail-wg0-f51.google.com with SMTP id z12so5361818wgg.6 for <16567@debbugs.gnu.org>; Mon, 27 Jan 2014 04:14:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=QxG41JzGkYPiMeonGtOwGGGncLLuboArn2SW/hmbIds=; b=EtAyNuMAhePkzs63DtHf6eeTTRa+WlyCnZ1CdXumuAayHou7e4KLJTKysLHrkedf+3 eeDtJMx1Ntje1NHwVGsk6Uqpivy1FJlQ9uCqRU5leu4Ga+Ldb8TpofF2WXExCkL2UqrP jbaKJGjyuaRWqB/ayq6Czr7QnZYvtAEOkH3bmyw5kOH2gJJUvKIvg/7ukJJe3mTjdEGF imlV+ZxErGF/mfJBNL0a4nxXJVn8oGgfvmyOx99vsxoeuTHi18ig7lzCKvbB6gMxX6Th oUHuPRxbR+C+Ch+DzturEYruVdJsj0Zx9GV3KeRkekJI1F+rj4BNGTHq7r4blvH0FEdS D+tg== X-Received: by 10.194.78.179 with SMTP id c19mr24018wjx.84.1390824843555; Mon, 27 Jan 2014 04:14:03 -0800 (PST) Original-Received: from localhost (reverse-177-95.fdn.fr. [80.67.177.95]) by mx.google.com with ESMTPSA id dd3sm24779938wjb.9.2014.01.27.04.13.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 27 Jan 2014 04:14:03 -0800 (PST) In-Reply-To: (Helmut Eller's message of "Mon, 27 Jan 2014 12:56:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:84108 Archived-At: Helmut Eller writes: > On Mon, Jan 27 2014, Daimrod wrote: > >> Helmut Eller 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