From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Mon, 29 Oct 2018 16:18:30 -0700 Message-ID: <87in1kxry1.fsf@ericabrahamsen.net> References: <83tvlcsnee.fsf@gnu.org> <86mur137n8.fsf@gmail.com> <20181029130132.GB4195@ACM> <20181029134722.GC4195@ACM> <87lg6gifnb.fsf@web.de> <87muqwxs7m.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1540855007 2585 195.159.176.226 (29 Oct 2018 23:16:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 29 Oct 2018 23:16:47 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Stefan Monnier , emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 30 00:16:43 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 1gHGm2-0000Zy-CI for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 00:16:42 +0100 Original-Received: from localhost ([::1]:49526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHGo8-0000WT-6a for ged-emacs-devel@m.gmane.org; Mon, 29 Oct 2018 19:18:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHGo2-0000WK-EJ for emacs-devel@gnu.org; Mon, 29 Oct 2018 19:18:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHGnv-0006PM-JO for emacs-devel@gnu.org; Mon, 29 Oct 2018 19:18:44 -0400 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:44287) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHGnr-0006H9-Fx for emacs-devel@gnu.org; Mon, 29 Oct 2018 19:18:37 -0400 Original-Received: from localhost (50-251-205-17-static.hfc.comcastbusiness.net [50.251.205.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 68DF83F094; Mon, 29 Oct 2018 23:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1540855113; bh=INWu26NiL6PtTaUwh/Ku4PCMzhfpqhNXh8U8C/PQ2hU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Mj7w5j/9aQLQo9ujSX/X7hDPeAZMJA7FgC2IQzsi5R/4NWwzQMh7KeMUN7D/Q0L6w IPjd7peiavzCqlIHvTg60ApZtQLepTAMSoPgebCKUJKe9Ncj7/TWEvMzwqvM6+ftSC nm3xQs6idInCavuaFCBmkyEoEw8bHCill8uQt5tU= In-Reply-To: <87muqwxs7m.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Mon, 29 Oct 2018 16:12:45 -0700") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 50.56.99.223 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:230784 Archived-At: Eric Abrahamsen writes: > Michael Heerdegen writes: > >> Stefan Monnier writes: >> >>> I'd rather keep it defined in terms of its differences w.r.t `dolist`, >>> but if really needed, we could change the doc so it doesn't rely on >>> `dolist`s own doc at all. >> >> I also don't think that would be an improvement. >> >>> +As in the case of `pcase-let', PATTERN is matched under the >>> assumption +that it *will* match. >> >> What this leaves a bit unclear: It sounds like matching itself happens >> differently (user visibly). Or does it just mean "if PATTERN doesn't >> match, the behavior [of pcase-dolist] is undefined/ this is not >> allowed". > > I wonder if the manual shouldn't have a section somewhere making > explicit the difference between `pcase' -- where a single value is > matched against many patterns, and may fail to match altogether, and > destructuring is only one of the use-cases -- and the other > pcase-derived forms, where many values are matched against a single > pattern, which *must* match (or error), and destructuring is kind of the > whole point. Conceptually, they're pretty different. In fact, when you think about it, the "case" nature of pcase is pretty orthogonal to the "match/destructure" nature of pcase. If anything fairly fundamental were to be done to refactor pcase, I wonder if it shouldn't be to separate these two concerns. In a sense, we already have `cl-case', why would we need another case-like structure? All we really need are new _matching forms_, which could be used within `cl-case', `dolist', `lambda'...