From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Garreau\, Alexandre" Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Thu, 01 Nov 2018 20:35:41 +0100 Message-ID: <87bm78a8vm.fsf@portable.galex-713.eu> References: <83tvlcsnee.fsf@gnu.org> <86mur137n8.fsf@gmail.com> <20181029130132.GB4195@ACM> <20181029134722.GC4195@ACM> <87lg6gifnb.fsf@web.de> <87muqwxs7m.fsf@ericabrahamsen.net> <83h8h3jlyd.fsf@gnu.org> <83efc7jjm2.fsf@gnu.org> <87tvl1poc8.fsf@portable.galex-713.eu> <83zhuth1z7.fsf@gnu.org> <87a7mtnziq.fsf@portable.galex-713.eu> <83va5ghdsx.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1541100893 23256 195.159.176.226 (1 Nov 2018 19:34:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Nov 2018 19:34:53 +0000 (UTC) User-Agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 01 20:34:49 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 1gIIjw-0005wk-IJ for ged-emacs-devel@m.gmane.org; Thu, 01 Nov 2018 20:34:48 +0100 Original-Received: from localhost ([::1]:43746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIIm2-0004xT-OE for ged-emacs-devel@m.gmane.org; Thu, 01 Nov 2018 15:36:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46358) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIIlp-0004wu-5W for emacs-devel@gnu.org; Thu, 01 Nov 2018 15:36:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gIIln-0000yU-N7 for emacs-devel@gnu.org; Thu, 01 Nov 2018 15:36:45 -0400 Original-Received: from portable.galex-713.eu ([2a00:5884:8305::1]:48332) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gIIlm-0000nT-GD; Thu, 01 Nov 2018 15:36:43 -0400 Original-Received: from localhost ([::1] helo=portable.galex-713.eu) by portable.galex-713.eu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIIlM-0007ns-CP; Thu, 01 Nov 2018 20:36:16 +0100 PGP-FINGERPRINT: E109 9988 4197 D7CB B0BC 5C23 8DEB 24BA 867D 3F7F Accept-Language: fr, en, eo, it, br In-Reply-To: <83va5ghdsx.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 01 Nov 2018 20:07:26 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:5884:8305::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:230961 Archived-At: Le 01/11/2018 =C3=A0 20h07, Eli Zaretskii a =C3=A9crit=C2=A0: >> From: "Garreau\, Alexandre" >> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org >> Date: Thu, 01 Nov 2018 06:21:49 +0100 >>=20 >> >> > @dfn{Destructuring} of an object is an operation that extracts >> >> > multiple values stored in the object, e.g., the 2nd and the 3rd >> >> > element of a list or a vector. @dfn{Destructuring binding} is >> >> > similar to a local binding (@pxref{Local Variables}), but it gives >> >> > values to multiple elements of a variable by extracting those val= ues >> >> > from an object of compatible structure. >> >>=20 >> >> =E2=80=9C(car list)=E2=80=9D is extracting a value stored in an objec= t, yet it=E2=80=99s not >> >> destructuring (though a list is a structure). Nor even is =E2=80=9C(= cons (car >> >> list) (caddr list))=E2=80=9D or =E2=80=9C(setq a (nth 1 list) b (nth = 2 list))=E2=80=9D. >> > >> > You forget the "multiple" part in the description. >>=20 >> Then you forgot =E2=80=9C(cons (car list) (caddr list))=E2=80=9D which I= proposed later. > > The values need to be extracted in one go, so the above doesn't > qualify. Let=E2=80=99s say this was in a language were arguments evaluation order is= not specified, and it is wrapped as macro/function set-two-vars-from-car-and-ca= ddr, how wouldn=E2=80=99t that match your definition? After all this later form can be considered as atomic, or pcase as not atomic (it will necessarily get one value before the other), to me that=E2=80=99s no what=E2=80=99s relevant to the destructuring concept: pca= se requires a pattern to specify matched data structure (same for cl-destructuring-bind). That=E2=80=99s what makes =E2=80=9Cdestructuring= =E2=80=9D. Another example: the pcase and pcase-* forms are destructuring, but the lambda pcase-* forms (full of car, cdr and other structure extraction functions call) are not destructuring, because they don=E2=80=99t refer to matched data structure, don=E2=80=99t specify it, and even ignore anything = not being related to what it needs to fetch. >> Wasn=E2=80=99t my definition attempt okay? it even defined three quite u= sed and >> intuitive terms. > > It didn't look like a more clear description to me, no. Do you have some more precise suggestion on why is not clear and how to clearly phrase the concept of =E2=80=9Cspecifying a matched data structure= =E2=80=9D, or should I just give up and accept the rest of world is fine with a more loose, large, less specific, and according to me, wrong, definition of =E2=80=9Cdestructuring=E2=80=9D?