From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: The poor state of documentation of pcase like things. Date: Sat, 19 Dec 2015 19:19:46 +0200 Message-ID: <83a8p6uzil.fsf@gnu.org> References: <20151216202605.GA3752@acm.fritz.box> <83d1u4xhja.fsf@gnu.org> <8737uytov3.fsf@web.de> <83bn9mv01p.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1450545579 19808 80.91.229.3 (19 Dec 2015 17:19:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Dec 2015 17:19:39 +0000 (UTC) Cc: jwiegley@gmail.com, emacs-devel@gnu.org, acm@muc.de, kaushal.modi@gmail.com To: michael_heerdegen@web.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 19 18:19:34 2015 Return-path: Envelope-to: ged-emacs-devel@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 1aALAK-0007FB-Qj for ged-emacs-devel@m.gmane.org; Sat, 19 Dec 2015 18:19:32 +0100 Original-Received: from localhost ([::1]:38083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aALAK-0007XU-06 for ged-emacs-devel@m.gmane.org; Sat, 19 Dec 2015 12:19:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aALAG-0007X4-U9 for emacs-devel@gnu.org; Sat, 19 Dec 2015 12:19:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aALAG-0000XN-0m for emacs-devel@gnu.org; Sat, 19 Dec 2015 12:19:28 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aALA9-0000V2-Eq; Sat, 19 Dec 2015 12:19:21 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3729 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aALA8-00053L-F4; Sat, 19 Dec 2015 12:19:20 -0500 In-reply-to: <83bn9mv01p.fsf@gnu.org> (message from Eli Zaretskii on Sat, 19 Dec 2015 19:08:18 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196515 Archived-At: > Date: Sat, 19 Dec 2015 19:08:18 +0200 > From: Eli Zaretskii > Cc: kaushal.modi@gmail.com, jwiegley@gmail.com, emacs-devel@gnu.org, acm@muc.de > > > > (pcase value > > > > (`(1 2 ,foo 3) > > > > (message "Matched 1, 2, something now bound to foo, and 3")) > > > > (foo > > > > (message "Match anything at all, and bind it to foo!")) > > > > (`(,the-car . ,the-cdr)) > > > > (message "Match any cons cell, binding the car and cdr locally")) > > > > > > So to bind something to 'foo' you just use "foo", but to bind > > > something to 'the-car' and 'the-cdr' you need to use ",the-car" and > > > ",the-cdr"? Why the inconsistency? > > > > The examples only differ because some symbols occur inside backquote and > > others don't. > > ",foo" in the first pattern is also inside a backquote, but it is > still different from "foo" in the second pattern and ",the-car" in the > third. So I'm still not out of the woods regarding the inconsistency. (Time passes...) Ah, I see: I was confused by John's different style: "now bound to foo" vs "bind it to foo". These actually intend to say the same thing: "match anything and bind it to foo", but the former wording made it sound like it was already bound to foo before, i.e. as if the first pattern _uses_ the existing binding of foo, instead of binding foo. Silly me, trying to assign too much importance to the wording.