From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Alfred M. Szmidt" Newsgroups: gmane.emacs.devel Subject: Re: Better documentation for non-binding clauses of if-let and friends Date: Mon, 11 Nov 2024 03:20:30 -0500 Message-ID: References: <861pzkmk5v.fsf@gnu.org> <5998bf4f-c35b-409d-9e76-d31ce037c8df@vodafonemail.de> <23d411e4-5bcb-4a24-a0ff-464a7b51b168@vodafonemail.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37332"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, eliz@gnu.org To: Jens Schmidt Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 11 09:22:15 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 1tAPgd-0009ZU-1q for ged-emacs-devel@m.gmane-mx.org; Mon, 11 Nov 2024 09:22:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAPfk-0002un-3W; Mon, 11 Nov 2024 03:21:20 -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 1tAPez-0002rK-Fr for emacs-devel@gnu.org; Mon, 11 Nov 2024 03:20:33 -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 1tAPex-00020B-RO; Mon, 11 Nov 2024 03:20:31 -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=1hHBeq2QEXbo54KeC93hRPlt80DfzTKnKrEMOuznDLQ=; b=LVfZRrSsXB7P Bni9opWdF8Zm4QI7MSTJkZgau2Cfm9kjbHsiRXyfvYIMFiCYJ/6O8jKlWQRK5M4XwHtxFd65O5NfZ K5/addv5SgBpYAtAmvIEClYqTYlbsDzA13oVAJ0x9EFPVp7KfRwFr8NmN3u/YvU7fVwBYvrTtLw+h SiJ5vPgwzGJdOnO70FJiFDT9aju3kzNYzVjBIei+DWJhM3gZXGScjkJYniYtvhykcwmn6UjaM6kf5 kwiSE1cznxjgLuhmUYNbDQZVIcR++3jfKl8jVLFS7k9JzciVQcznErGSCjXd9D79BPeI7Ezh9enuq Wx96Zodc0uB3hEKPU445qg==; Original-Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1tAPew-0003SU-Ir; Mon, 11 Nov 2024 03:20:31 -0500 In-Reply-To: <23d411e4-5bcb-4a24-a0ff-464a7b51b168@vodafonemail.de> (message from Jens Schmidt on Sun, 10 Nov 2024 13:24:46 +0100) 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:325396 Archived-At: I rather agree with Joost on that other thread regarding the usefulness of the FOO-let macros and their condition-only, non-binding clauses. I don't think anyone is arguing about their usefulness, only that the macros are too smart for their own good. > There is no mention of this in the manual, that only says that SPEC is > like the one in LET*. But I agree with you that the manual is incomplete or even wrong here. How about the following in section "Conditionals" instead of what there currently is about these: There's a number of variations on this theme, and they're briefly described below. For all of these SPEC is similar to what let* offers, with a few extensions useful in the context of testing conditions: As with let*, an element of SPEC which is a list (SYMBOL VALUEFORM) binds SYMBOL to the value of VALUEFORM. An element can additionally be of the form (VALUEFORM), which is evaluated and checked for nil; i.e. SYMBOL can be omitted if only the test result is of interest. It can also be of the form SYMBOL, then the binding of SYMBOL is checked for nil. For all of these SPEC is similar to what let* offers, with a few extensions useful in the context of testing conditions: That sentence doesn't add much, and will make the user guess if there are other useful extentions -- "with the following extension" would suffice I think. As with let*, an element of SPEC which is a list (SYMBOL VALUEFORM) binds SYMBOL to the value of VALUEFORM. An element can additionally be of the form (VALUEFORM), which is evaluated and checked for nil; i.e. SYMBOL can be omitted if only the test result is of interest. It can also be of the form SYMBOL, then the binding of SYMBOL is checked for nil. -- Macro: if-let spec then-form else-forms... Evaluate each binding in SPEC in turn, stopping if a binding value or value form is ‘nil’. If all are non-‘nil’, return the value of THEN-FORM, otherwise the last form in ELSE-FORMS. The description here should explicitly mention that SPEC is _NOT_ a binding if the spec only contains the VALUEFORM. And so should all other descriptions. -- ... If needed, I can provide that or something similar as a patch ...