From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Instead of pcase Date: Tue, 9 Jan 2024 10:43:00 +0000 Message-ID: References: <87fs169mjj.fsf@posteo.net> <093f11a1-57c2-5e56-d39b-26fef1c67cbb@gutov.dev> <25942.25061.217864.329049@retriever.mtv.corp.google.com> <87zfzdcz6z.fsf@posteo.net> <763f067b-4ca9-1eba-9f3c-424c38589e9c@gutov.dev> <83fs0navpj.fsf@gnu.org> <838r6ebfhw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5336"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , owinebar@gmail.com, rms@gnu.org, dmitry@gutov.dev, philipk@posteo.net, emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 09 11:44:10 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rN9ab-0001G5-5V for ged-emacs-devel@m.gmane-mx.org; Tue, 09 Jan 2024 11:44:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rN9Zn-00064D-JC; Tue, 09 Jan 2024 05:43:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rN9Zm-000645-A2 for emacs-devel@gnu.org; Tue, 09 Jan 2024 05:43:18 -0500 Original-Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rN9Zk-0004Lp-Jg; Tue, 09 Jan 2024 05:43:18 -0500 Original-Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2cceb5f0918so29259361fa.2; Tue, 09 Jan 2024 02:43:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704796992; x=1705401792; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5PdQFukhLKbAoEjh8EYEYAyL0Q/XZWS8rsp+VVN4teA=; b=PEHMWqJbXksbunEis3agVxkGCHf8oDKjfPviFxelBKDD6p8ghFjKA21ultYPQHHpR1 qkgrJAko8ua+Y8XEJZY0pM6rqFL9W7oTy1Sr7N+dmeZl9W7dfUB1o90gbi+4iG2bd60/ UXZZsYRaT6X5nRoqeaxrcJuyfUwyutq66zx3boQtKg5+asih35Ny4GmUHfDwk6zpG7Z3 ErT/HzdFg7tdcZmVzIsEH5I/roGv+Mn/NIfU6tNenJKA7S3zDEU2FaKNh8CtnEtsTOsK dT/aq4O3LvDQ5gaOH/vnCXILhpGup6tpix9RIs2NB9Pt0VsRTVnWh455HIve8181Fdgn O3qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704796992; x=1705401792; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5PdQFukhLKbAoEjh8EYEYAyL0Q/XZWS8rsp+VVN4teA=; b=APq1susGM54E1mS3brsvbfiVXrSOX4faG00YxV7CLSshoG0L5rSphEhBnNRotwMQ9E 0FjVnaGs4ZvrxDfgcBCrjjE0koQcVHdx2zsZ2LaeRwslUhBGRdXjha5VA5S99VRxlLmw pZgA01yFV74IhqddprdN8D7wK0t3Ui4Inr9BYXp4r7eHCeZjzBQLTa3Mk6Bra6egw+WQ AnBgmFR7Tz843VPUaYlXWrQ+whW6TDnSqheQfhLhJ680yXynwsI8UauwumaXjmQwRHvs HW3LSXQsZiPM0EtQ6kvf33gkWJA3YRkbl8sUHSQU3qvK2+GQGCNo9irealTEdGV++Jw8 TtPQ== X-Gm-Message-State: AOJu0Yx3+WxL36U+Qx0K978Reukdpk7Vwmw5ruPNOtrhyiW5Mwz8ZwVQ zlwhMPTbrltv6PHkOUUqjRID8IzJ6p+WsNr25R0yZ7UwW9I= X-Google-Smtp-Source: AGHT+IFhrOjarWglQyTGV0sZ8MtSHIQQqKlMO/2oaIADptSm7AU2lefjCN72VolzXx7+EfuLXFzTkakELjxs5GM7A0c= X-Received: by 2002:a05:651c:c2:b0:2cd:2838:777 with SMTP id 2-20020a05651c00c200b002cd28380777mr1311849ljr.26.1704796992409; Tue, 09 Jan 2024 02:43:12 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=joaotavora@gmail.com; helo=mail-lj1-x235.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314775 Archived-At: On Tue, Jan 9, 2024 at 5:33=E2=80=AFAM Stefan Kangas wrote: > > You take a backtick-starting construct with as many scary periods > > things as you can find and then, say > > > > `(,foo . (,bar . ,baz)) > > > > And then ask yourself: "what kind of list does this build if I just > > let-bind foo, bar and baz to 42?". And then you answer yourself > > "Why, it's the improper list (42 42 . 42) made up of just two cons > > cells and 3 fixnums!". So _that's_ the kind of list that can be > > destructured with the pcase expression. > > > > This solves the reading problem. Now the writing problem. To author > > new pcase patterns one uses more or less the same process. One again > > leans on one's existing knowledge of how the list structure would be > > expressed with backtick-and-quote. So once you know the list > > structure in your mind you write it as a backtick-and-quote expression, > > just as if you were going to craft that list (though you aren't of > > course). Then once you're happy with your expression, you may take it > > and you put it in one of the BINDINGS left-hand part of a 'let'. > > Then you rename that 'let' to 'pcase-let' and away you go! > > Could you reformat this as a documentation patch? TL;DR: Maybe I will do that "if noone beats me to it" (TM). All the ideas I had to share are already there and free to use. If you find these ideas useful or their exposition elegant, I'm flattered :-) but there's still the work of finding the correct spot in the pcase documentation where they would fit better and identifying what other parts of that doc they now supersede, so that a cohesive whole can be achieved. This is usually the most difficult part of adding to existing documentation (very similar to maintaining code, actually). Then there are more minor stylistic and formatting issues, but these are still some effort. I don't have the resources to do this work right now, and properly coordinate with other people updating other parts of that documentation. Jo=C3=A3o