From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: if-let/if-let*/and-let/.. Date: Thu, 22 Feb 2018 02:08:16 +0100 Message-ID: <87sh9t4yrj.fsf@web.de> References: <87wozijhpk.fsf@web.de> <87mv0crbp3.fsf@web.de> <20180213193126.7ifsybvdx7cnjb4f@logos.localdomain> <87wozgph70.fsf@udel.edu> <87y3jv186x.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1519261890 20743 195.159.176.226 (22 Feb 2018 01:11:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 22 Feb 2018 01:11:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) Cc: Mark Oteiza , npostavs@users.sourceforge.net, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 22 02:11:25 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eofPx-0004vp-6X for ged-emacs-devel@m.gmane.org; Thu, 22 Feb 2018 02:11:25 +0100 Original-Received: from localhost ([::1]:35530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eofRx-0007Mt-T1 for ged-emacs-devel@m.gmane.org; Wed, 21 Feb 2018 20:13:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eofQA-0007Gh-Ey for emacs-devel@gnu.org; Wed, 21 Feb 2018 20:12:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eofN6-0000xR-1h for emacs-devel@gnu.org; Wed, 21 Feb 2018 20:11:38 -0500 Original-Received: from mout.web.de ([212.227.15.3]:54707) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eofN5-0000v5-Fj for emacs-devel@gnu.org; Wed, 21 Feb 2018 20:08:27 -0500 Original-Received: from drachen.dragon ([188.99.169.170]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M0Qxx-1eUFLD0x3d-00uXCC; Thu, 22 Feb 2018 02:08:18 +0100 In-Reply-To: (Stefan Monnier's message of "Wed, 14 Feb 2018 22:37:51 -0500") X-Provags-ID: V03:K0:BHNHQ6s9dFsbaWV4WnFpoCtZMNUm08DZ2yUt2t1C1i5XyOHQsns tUPoiGWZezakedjksnFX8ixG/XVZnPJTHT2Zl7SDMMY7wFQFG6jwSyW0ltBk2daiuq2fA/U CGDBdFY3LS0o/G7zb4qB6iRm3Pq8mDg22s3il++MDNX6jYbJTrFXUpBEt9JAu2DMEVcIWnb ItC9jKd4xLz25eTvEnwmw== X-UI-Out-Filterresults: notjunk:1;V01:K0:yr0qrsDQt2Q=:Dl2cYZjTlGUmugJVNX13CK uhMPkfTsRwTJA2j0PNa/WTFZq4Xn4b1HbMJq8DeGWe/3j+funUDwn960D+Mo2s4z1DrFKofD3 WayOj70v+IHtQCIDlp/Ldtg5VIj6lRQth9Cs/pvx9mAiNBE7cIMUyy0ijtd8Ykr4O1nrDGMZP 3dH/mGu+z+FRYFsocNBDtnWG/Ajx3X8/9tR0BzAnxOSlnBySBiC/oxLF32iDqwdazMIfctkzl Cj1EB64KHANZY0W/zI6rmocK1ZR1wzJr10SHukAzzgsNIB+IUsWv+ZM51iqUinTP5Vrd6EQJo uZtuAMnRU2/B7tXVF9bpm0z11J5nkR7jlFZ/Wk1h0daZUGnZJe7yagJ1HzsePP5e/8XlHFkSb CAxxQrIo+I341YsGs6J3Cs2ohBpjXD3uG0bM6fWbCW5Qf8WnJpNp25S1A9wDoBEpKFooR5taa 2qYMkE1vjjgdHgIBXlPCbbRTvBSoLLLn9hsb0wFo3lRFO7242Q9WSNQCi8R3IotvkTcC4IPgj xExzgVBwTokRiGPD0kE6Fe8wvyVRJHjrkbCLPuBnuFV4kjFXEPX3X8tOeZjinC7Eq/FfRhILi IBinSgaJatg+2PNF93OYVuFY5gmv2DobzPEf6W5iNQ/wCiFdF75E6mAJz4XXUKQcPp/J872iA N8gLYOyFcsVT4SVwdQKGvGxidiorP3w806gEZnL8TXYwKluYSmIla+tta23eCPnM2eZP9iXiS rs4JUPtc8++ly3hUaDO4PMgyXUXi64iBvNSvG+t1yK7F14toErVugYwwfTsbjOAneuLnNHe5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:222973 Archived-At: Stefan Monnier writes: > > (if-let* (x (y 1) (z 2)) "dogs" "cats") => "cats" > > Same as the first case above, we could/should detect this case during > macro-expansion since this is not of the form (VAR EXP) but (VAR EXP > EXP). I understand now what the problem is. Mark had implemented and-let* as in srfi-2: https://srfi.schemers.org/srfi-2/srfi-2.html (scroll to "Specification") which interprets a (bound) symbol in the binding spec as a boolean. Noam then had asked for making if-let's binding SPEC compatible with that of the new and-let* - but the single-binding case of those was incompatible with that, so foo-let* were born breaking with the single binding case, and at that time we wanted to introduce these names anyway. foo-let were then reimplemented based on foo-let* but made still supporting the single-binding case for backward compatibility as special case, and also marked obsolete to not have two versions of the very same thing. That treatment of a single SYMBOL in the SPEC is redundant AFAIK (in the SRFI2 and in master) since it can also be written as (SYMBOL). If we sacrifice the absolute rigid compatibility with SRFI2, we can treat the binding SPEC, as Stefan suggested, like #+begin_src emacs-lisp (pcase spec (`(,(pred symbolp) . ,rest) (pcase rest (`(,_) (cl-callf list spec)) ;the single binding syntax (_ (signal 'error (list "if-let: Bad binding spec" spec)))))) #+end_src being slightly backward incompatible since | 4612b2a2b37026bef5a9b8e92878a15dabb9b261 | Parent: c87331a1c0 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs | Merged: emacs-25 | Containing: emacs-26 master | Follows: emacs-25.1 (130022) | | Implement and-let* Michael.