From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Code for cond* Date: Thu, 25 Jan 2024 23:30:23 -0500 Message-ID: References: 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="9222"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jan 26 05:31:28 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 1rTDsF-00027i-89 for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Jan 2024 05:31:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTDrH-0006T9-Ai; Thu, 25 Jan 2024 23:30:27 -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 1rTDrF-0006Pd-8O for emacs-devel@gnu.org; Thu, 25 Jan 2024 23:30:25 -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 ) id 1rTDrE-0000Sq-9e; Thu, 25 Jan 2024 23:30:24 -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=++bNgJ7cjfhGr080n+QI9OrI5fWlyNarago/1QPM2u0=; b=RmmAWNx1msbx adfnv7h0ce0wjD9h8l0/5m/9f8zbhXBNqvX4EQ6ka2BjPMqbzMn0bfIqtG3ms3wichiYLlIjnA4OA qz2upNE01sgpk6naum5sPjFs+UTZXmP0uPyyqrQYDQKklOEBto8FXFcTXAfblJlgOwmdQfdM2QSi4 TGaIIVap6Wx2luGD7e/3qYcn51EnzeE/qAN/3MilMdz8AwFR8BnbJ3+vvIPMEwk8A2MZ3nDJAKYHb cuff7NTWzXW7NeADzm37BnOhCi0XQEZ/Fn4lnP3CCBnJUZcBD0ovEM8AcHkZ4SCxdFX4xrzqzXipk ef6d78giUoEbKJQcYtrLxg==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1rTDrD-0006Q6-FF; Thu, 25 Jan 2024 23:30:23 -0500 In-Reply-To: (emacs-devel@gnu.org) 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:315410 Archived-At: [[[ 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. ]]] > > ;; Execute FORM, and ignore its value > > ;; (except if this is the last clause). > > (FORM) > YAGNI. If this were a special feature, it might not be worth having. But it is not a special feature. It is a special case of the general rule that a clause with one element is a non-exit clause. I think it will sometimes be useful to execute something unconditionally in the middle of a cond*. > > ;; Variables to bind, as in let*, around the rest > > ;; of the cond*. > > ((bind* (x foobar) y z (foo 5) a)) > > ;; Bindings continue in effect for the whole cond* construct. > This is one of the functionality missing from `cond`, so I'm rather > favorable, but: > - why `bind*` when the rest of ELisp uses `let*` in the names of all > related constructs? `let*' is a Lisp function, and that is reflected in the syntax for using it. Calling this `let*' would be misleading, because this is not a Lisp function and can't have syntax similar to that of `let*'. There is no way that it could fit into cond* and have syntax like `let*'. So better it have a different name. > - Why the double parens? They make this a clause with only one element -- in other words, a no-exit clause. It would be possible to use the syntax (bind* BINDINGS...) and say that `bind*' is a syntactic special case. I think that having the no-exit rule is simpler overall. However, I see no way to do this for `match*'. It will be used in both exiting and non-exit clauses. I don't see any other simple syntax to use to distinguish those two cases. Do you have a suggestion? > - Why `*`? I put * at the end of the names `bind*' and `match*' to go with `cond*' and thus make it easier to recall how they go together. Also to make it clear that they are special syntax, not Lisp functions, so their uses can't be understood like function calls. To omit that * would be straightforward, but I think those reasons are valid for keeping it. > - I'm not happy about using the same construct for "bindings > for this clause" and "bindings for subsequent clauses". The alternative to having a uniform rule to distinguish a non-exit clause from an exiting clause is to specify four special symbols, one for each combination (matching vs binding, one clause vs remaining clauses), like this: MATCH BIND ONE CLAUSE match* bind* ALL CLAUSES match** bind** I am not wedded to those four names. If people who like cond* would prefer it with this change, plesae let me know. -- 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)