From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: RE: [External] : Re: cond* vs pcase Date: Tue, 6 Feb 2024 14:08:59 -0600 Message-ID: <822c332c-1a85-4454-8978-0b1491981058@alphapapa.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21123"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: ams@gnu.org, arthur.miller@live.com, emacs-devel@gnu.org, philipk@posteo.net To: drew.adams@oracle.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 06 21:09:49 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 1rXRlM-0005It-QQ for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Feb 2024 21:09:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXRkm-0002sc-9x; Tue, 06 Feb 2024 15:09:12 -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 1rXRkh-0002sI-O0 for emacs-devel@gnu.org; Tue, 06 Feb 2024 15:09:08 -0500 Original-Received: from snail.cherry.relay.mailchannels.net ([23.83.223.170]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXRkf-0003Fy-TM; Tue, 06 Feb 2024 15:09:07 -0500 X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 2D0F5102943; Tue, 6 Feb 2024 20:09:02 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a214.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C06851028A5; Tue, 6 Feb 2024 20:09:01 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1707250141; a=rsa-sha256; cv=none; b=idgDOigwkl3y9W0bb10HCreQrwsplmSmrPAD8/+0aMZuJRk3BnDHzoRX/cw58mtcd4V3fE uD1L4bA90IkiPgDBgRRKDBWzKkPw+sxspdznKANnLQXV9gJ2X7V5x60RfV7xD2dzhO1Gpa ZENxQ0cBH2r3GjTLIo2zpHcQJGKDwURQAkgJ4lJbrHgkxON5X4MlmU8rQYFf7TMLnXINRe 1KPQzPn+WQqNRayl041jLHDP+CSBieamgoObAW5lAo8H5/i3xXEM/LyzKcJw4w/JoTxPp6 vwn736SO91jt6nrRALuQKbY65neJ0ULtRSD63ccE9KTvsnetc3LdsmmzWDin+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1707250141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xZ+b0RglWUDe8PFi6WjarVMG/x+0VagRa5CfGnJoGC4=; b=ULlqSTasO+Tqlz8bKkiTTDryCzvOwVAiV8Y06UiIquwoU/Wm2Jf3LPfvXQjSjzIYNp7r+R OVDLAIfY3FG8BRNRuDd5RPK3Hl0qsUI0/rW/MeJWQbO/6/P4QiiabCAtYMVzgzGo1uC0JO Wn3uhNb7TsCfrUM0choDbiJbEjXa44sCSs1ACDkDYt/ZB6+RG19zSyFxR5AAAC3pq1HmN6 qHwEkPfhzK4QLq+hp3cOVwyn+M26La4342Ue3ls0r/wrK3EAj+3EPaf2qBwhQzm0cRNzTs ZfppUlIpZ1d5Fsv9AjjVaewWnj6z7cqywQsS/GObFlTKjx/s+mYoIxfXIdUN2w== ARC-Authentication-Results: i=1; rspamd-55b4bfd7cb-w6rm9; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Tart-Stop: 45255c1c2c034b0c_1707250142055_540533268 X-MC-Loop-Signature: 1707250142055:1088197329 X-MC-Ingress-Time: 1707250142054 Original-Received: from pdx1-sub0-mail-a214.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.109.231.231 (trex/6.9.2); Tue, 06 Feb 2024 20:09:02 +0000 Original-Received: from [10.43.0.186] (unknown [193.56.116.15]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@alphapapa.net) by pdx1-sub0-mail-a214.dreamhost.com (Postfix) with ESMTPSA id 4TTvTS2ZSgz8R; Tue, 6 Feb 2024 12:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1707250141; bh=xZ+b0RglWUDe8PFi6WjarVMG/x+0VagRa5CfGnJoGC4=; h=Date:To:Cc:Subject:From:Content-Type:Content-Transfer-Encoding; b=rnLLZBMbnACJ/XgJ0fjSdiv0fJa8JJ5HSRnlyCXozZ88U1yYTgMHcOs1fg+obuKKj gudOv2kwEFITwI9lL9Mf20suxUXfIgVnFrY+q3kr3BYTZzwckwVPmg29coswyV0ZBl oerOkmlkAN0ttEpKI4L4eE88pub9EyydoQlWnexaKUzxcZD1YGBTe/9MPgL6o7nL5l SxGm5qjk6BOIAHD2+KjWOlpYDZJyCQdKkvzXqXuGAL+DgOT96grG1PclWWnSFnij0x 39MCgBH7dOQpPReKKtoH0ZolWL3wkXs9z/9YSX18Nxo0DLekvEiD25c+WtCR3SjQXZ QVQHZO6RnuE/g== Content-Language: en-US In-Reply-To: Received-SPF: neutral client-ip=23.83.223.170; envelope-from=adam@alphapapa.net; helo=snail.cherry.relay.mailchannels.net X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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:315947 Archived-At: > It says, in effect, "This just tests the > value for simple equality (using this or > that equality predicate)." It speaks > quietly, humbly, clearly. > > `pcase' advertises instead: "Here come the > Big Guns, which can wrestle _anything_ to > the ground! Stand in awe and wonder." CL-CASE and PCASE neither say nor advertise anything. They have no personal qualities. They are macros, not people. (pcase foo ('bar (do-some-bar-stuff)) ('baz (do-some-baz-fluff))) is not more awful or wonderful than: (cl-case foo (bar (do-some-bar-stuff)) (baz (do-some-baz-fluff))) And neither of them is worse than what they expand to: (cond ((eql foo 'bar) (do-some-bar-stuff)) ((eql foo 'baz) (do-some-baz-fluff))) Nor is this: (pcase foo (1 'ONE) (2 'TWO) ((cl-type function) (funcall foo)) (_ 'SOMETHING-ELSE)) any worse than what it expands to: (cond ((eql foo 1) 'ONE) ((eql foo 2) 'TWO) ((cl-typep foo 'function) (funcall foo)) (t 'SOMETHING-ELSE)) That example is not even a case of pattern-matching, as no patterns are involved. But if one needed to add a pattern, as in the common case of a customization option having various possible value types, one may easily do so, as in: (pcase foo (1 'ONE) (2 'TWO) ((cl-type function) (funcall foo)) (`(,fn . ,arg) (funcall fn arg)) (_ 'SOMETHING-ELSE)) I cannot fathom how this optionally available "power" is a problem which should consign PCASE to only exceptional cases, any more than Lisp's power should consign it to only a few libraries, leaving the rest to be implemented in lower-level languages; or any more than Emacs's power should consign it to only a few use cases, leaving the the rest to be implemented in utilities to be piped together in a shell.