From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Richard Stallman <rms@gnu.org>
Newsgroups: gmane.emacs.devel
Subject: Re: combining cond and let, to replace pcase.
Date: Sun, 26 Nov 2023 22:11:47 -0500
Message-ID: <E1r7S2F-0004TC-7l@fencepost.gnu.org>
References: <E1r3SgH-0007Rb-BU@fencepost.gnu.org>
 <iery1exiv1q.fsf@janestreet.com> <E1r4Bci-00043P-VJ@fencepost.gnu.org>
 <E1r5zva-0006B6-JQ@fencepost.gnu.org> <jwv8r6m2zve.fsf-monnier+emacs@gnu.org>
Reply-To: rms@gnu.org
Content-Type: text/plain; charset=Utf-8
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="37655"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: emacs-devel@gnu.org
To: Stefan Monnier <monnier@iro.umontreal.ca>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 27 04:12:20 2023
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
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 <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1r7S2l-0009bV-84
	for ged-emacs-devel@m.gmane-mx.org; Mon, 27 Nov 2023 04:12:19 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1r7S2H-0004a5-5O; Sun, 26 Nov 2023 22:11:49 -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 <rms@gnu.org>) id 1r7S2G-0004ZT-2L
 for emacs-devel@gnu.org; Sun, 26 Nov 2023 22:11:48 -0500
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rms@gnu.org>)
 id 1r7S2F-0002kd-Fq; Sun, 26 Nov 2023 22:11:47 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From:
 mime-version; bh=w/3rSl16DdzLqoGJa98jPVIkmUsyYEUaEcd9iYTQzlE=; b=a8pwikBuZVSL
 WtRgSCprYOdK9PTrHkXSyvPB+ICXerOCC7cIGIeqnH3qWnhTs0CKjSW3fMwaDg+f5rWbHGcZrquIR
 QYrYUeFhcV81NpAwwicr5PRVFgOW0JNj1+xziI9XKeGC3wQQPVzQoV5q01Zs9zTBibH5Lc5lKb130
 l6iw+q9PcNQ3Um9UgkEF+Lvdwd0OloIeesL2JKzlA90gjtG/ygdDKTAutknhrgeHH5hL6IGA5ioBO
 Ac6+QN5hc9VpxEpHusNG0O0RsOE5tVZpEu/LVX2Ijcl046nHPND3qEJadhVUcBZC7r7uVW1KJ2PSU
 pERCAt4aav1lGaRowxGZrw==;
Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <rms@gnu.org>)
 id 1r7S2F-0004TC-7l; Sun, 26 Nov 2023 22:11:47 -0500
In-Reply-To: <jwv8r6m2zve.fsf-monnier+emacs@gnu.org> (emacs-devel@gnu.org)
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=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:313255
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/313255>

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > >        ;; Extracts substructure and binds variables around the rest
  > >        ;; of the cond*.
  > >        (:match (`(expt ,foo ,bar) x)
  > >         do-this-if-it-matched-then-exit...)
  > >        ;; Bindings continue in effect.

  > Which bindings?  Presumably when we continue the match failed, so `foo`
  > and `bar` don't have any meaningful value to take, AFAICT.

That is a good question.

I've concluded that, for this form of the clause, which will exit if
it executes the body of the clause, the bindings should be made only
for that clause.

  > >        ;; Like above but always falls thru to next clause.
  > >        (:match (`(expt ,foo ,bar) x))
  > >        ;; Bindings continue in effect.

  > What happens if `(car x)` is not equal to `expt` or if `x` is a string?

This form of clause should bind the variables unconditionally.  If
matching provides a value to give a certain variable, the variable
should get that value.  Otherwise it should be bound to nil.

This way, which variablss are bound at any point will not depend on
the valus of the data.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)