From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Tue, 30 Oct 2018 18:14:34 +0000 Message-ID: <20181030181434.GB5705@ACM> References: <86mur137n8.fsf@gmail.com> <20181029130132.GB4195@ACM> <20181029134722.GC4195@ACM> <83r2g8klf9.fsf@gnu.org> <9bfd9d19-3b6b-57cd-50a0-24660707768b@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1540923172 8569 195.159.176.226 (30 Oct 2018 18:12:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2018 18:12:52 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org To: =?iso-8859-1?Q?Cl=E9ment?= Pit-Claudel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 30 19:12:48 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHYVS-00026U-En for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 19:12:46 +0100 Original-Received: from localhost ([::1]:54889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHYXY-0005Xc-Q2 for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 14:14:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHYXS-0005XU-7i for emacs-devel@gnu.org; Tue, 30 Oct 2018 14:14:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHYXP-0005V9-Fd for emacs-devel@gnu.org; Tue, 30 Oct 2018 14:14:50 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:25949 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1gHYXP-0005JW-1j for emacs-devel@gnu.org; Tue, 30 Oct 2018 14:14:47 -0400 Original-Received: (qmail 31812 invoked by uid 3782); 30 Oct 2018 18:14:29 -0000 Original-Received: from acm.muc.de (p5B1479F4.dip0.t-ipconnect.de [91.20.121.244]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 30 Oct 2018 19:14:28 +0100 Original-Received: (qmail 5805 invoked by uid 1000); 30 Oct 2018 18:14:34 -0000 Content-Disposition: inline In-Reply-To: <9bfd9d19-3b6b-57cd-50a0-24660707768b@gmail.com> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:230841 Archived-At: Hello, Clément. On Tue, Oct 30, 2018 at 11:05:55 -0400, Clément Pit-Claudel wrote: > On 30/10/2018 10.16, Andy Moreton wrote: > > How are users meant to write reliable code using such constructs ? > Ensure that the pattern actually matches :) You mean, unless you can be 100% sure that the pattern will match, you mustn't use pcase-... constructs. That sounds equivalent to saying you shouldn't use these constructs at all. > IOW, only use these constructs when it's an invariant of your program > that the pattern will match the data. For cases in which the pattern > might not match, use pcase instead of pcase-dolist. pcase is not a looping construct. pcase-dolist is. They're not replacements for eachother. -- Alan Mackenzie (Nuremberg, Germany).