GNU bug report logs - #59786
Allowing arbitrary expressions in cl-labels

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Stefan Monnier <monnier@HIDDEN>; Keywords: patch; dated Fri, 2 Dec 2022 19:45:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 59786 <at> debbugs.gnu.org:


Received: (at 59786) by debbugs.gnu.org; 13 Jan 2023 13:48:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 13 08:48:06 2023
Received: from localhost ([127.0.0.1]:49905 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pGKPe-00063X-5e
	for submit <at> debbugs.gnu.org; Fri, 13 Jan 2023 08:48:06 -0500
Received: from mout.web.de ([212.227.15.4]:59201)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1pGKPc-00062M-AF
 for 59786 <at> debbugs.gnu.org; Fri, 13 Jan 2023 08:48:04 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273;
 t=1673617674; bh=nab5GbTjOU/8czPCqx5u5r26AUBPzLxV2zsUF4wZF30=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date;
 b=TKU/pcHZGS8OqmK1jC5sjfY6fPao2JaXTkfqzZubL36E/L2rsc11O24E2mVM3VoTc
 ezgMuAI4FBOS9T7lwe7vtUBhPG2A4oXxaXqARutBDqf7fdQ1OyyH3r12TO1QN+M6zw
 z6938RSc64sEU04y18awDHH2+XAkbGyt6qF20QzH1fEapO1TCJdaL0qLaUc3xJHFU1
 67nz8l6fj8Iy/+ohTWJSvdFb4nPH8TgReNIjHOPfLOJbjJubJHFBbIQ5K+VdqtiNDZ
 H3wyCq1oyj1yvAU+VFRlmtzpfS4enM2iCqP4GlBuHKM1Cq99ZOLkk6UyoivBzatsCe
 GWhdANXwxqSpg==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([84.59.210.57]) by smtp.web.de (mrweb005
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N9LEG-1odt5a05G0-015Kz2; Fri, 13
 Jan 2023 14:47:54 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#59786: Allowing arbitrary expressions in cl-labels
In-Reply-To: <jwv359xr3oy.fsf@HIDDEN> (Stefan Monnier's message of
 "Fri, 02 Dec 2022 14:44:13 -0500")
References: <jwv359xr3oy.fsf@HIDDEN>
Date: Fri, 13 Jan 2023 14:47:52 +0100
Message-ID: <87r0vybl6f.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:qYyZMFEfQbE4UY73cK+vjnxTx1NUGWNPd/t2teNqGREsH3eTniF
 /SO6Ym6DiELZUX6wNcGiyjSy5hwkPCElAO4kx+nRdeNJS0LRLW7nqxhDIUdFCn2R4FfQXyL
 5JqFfin2kQCr4IsWHh1Nia622/8efZ1MgzzWD9DV2lF/FkSJKHMJeE5Ei7jLpBzBU6qlOkv
 HupMRDz6JruH26ryULVfQ==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:DVXbCAW74z4=;bpkqgxEbOO4WTfCDvvWpDWYDw7p
 4QH3OB3CqqVyzG0H62XPuyvc1OXUSxnAK4JhrlPNp9bVYJlsoZC8sYhsbO7bCtTd2dXeYOCeL
 BqJYdEPb//IEXTTvYLzHIw9pb35D+sTE4+lXbrqow90X3a0vg+JeRn6+uD3P6o6DBjBgcqPFL
 3CbUKOe12zGyCKu35teni8IMUhPX3+U+SW1QfP+zN6DZdHSn/ZqYdHG/z2chUyc6TzLrs+6a5
 UmKiWo+VFWvTySYSvWAHmGmsqQkrO96tkS3P4Hckcf8QBevnsggvsuHWRXpBDKKdez2z/ZpIS
 Viu3jXyc0zkpyo1skvXq3EkKSwn6H4zWrnqGVYTU1fy212UCTgQmf9G3AUPqVyXLkh40xCf9n
 8z3NlPPNAZq8gsnicU9Z4jgg9l6F8L1JW+LSB8ZaTBYhKfQCnLP9QYs+JO0ajSkk5/3d9Rdxn
 cU+GsoUfNsdRvfeEEQW2rnArIr+UxbB4rkA4Ak7TQSsxuncdoRYK6VvuLSDO/xrBRHHB/M8EU
 nVxgiM89VyTmwM1k3u2BsUYR915zLHJ0MPXEMDCKbjX7QbIibQtrPJfbtnh6jo6066NBx+yF4
 uPffSiJjam8AUkEOgdrKKJ+hH4qzHvwnzVInvOfcJ4JnvHkkm8dQC8X1K5I/dGWdhs+/MmYil
 LAc/SgrJKsR90USpP/qIjQvRzcpnB7EdfnwRNdcw0g+djo0y17JbLfav6lZQ27T8NZPe73vAF
 LR/XMRBNEW9s0ZVgNjbGFkZTs3RVvjnanZJKKIJ6oFB1cw8EGAaqEvjwYAfnOYGRn4gjeX42R
 lut3e7NVefF7sSc/NziygQPhgxiFk8JpujohBWf6q+tnL/I6FE2ATKDM/lej7HG6CnXhme5vo
 t08xh7cS488R75YgSc3uSDP2bbNq4GceE1j6OIE9TVceCZ6DqzkS8COwc5+1ZnZkykK7tn8+l
 eVYSFhrZno7xLWP6pa1hUXMAQJA=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 59786
Cc: 59786 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Stefan Monnier <monnier@HIDDEN> writes:

> The patch below uses this "new new" syntax (and adjusts `cl-flet` to
> also support this new new syntax).  It still lacks a NEWS entry (as
> well as updating the CL manual), but before I do that, I'd like to hear
> what other people think,

I like the idea to implement this kind of feature for `cl-labels'.  It's
a good change IMO.

I don't like the syntax I think (ugly).  The rest of this answer is
discussing this detail:

I don't recall all details about the ambiguity of the empty body case,
so forgive me if I'm missing something.

A binding like (my-fun (var1 var2)) with an empty body would give you
compiler warnings anyway.  Would this be an alternative to your "="
style syntax:

To specify a local function with an empty body one would have to use
local variable names starting with "_":

   (my-fun (_var1 _var2))

If not all variables start with an underscore or not all list members
are symbols, the binding is interpreted as specifying an expression
evaluating to the function to bind.  This assumes that "_var" never
specifies a named function.

Michael.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59786; Package emacs. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 59786 <at> debbugs.gnu.org:


Received: (at 59786) by debbugs.gnu.org; 2 Dec 2022 20:29:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 02 15:29:41 2022
Received: from localhost ([127.0.0.1]:48706 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p1CfE-0000xs-Ve
	for submit <at> debbugs.gnu.org; Fri, 02 Dec 2022 15:29:41 -0500
Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:61528)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1p1CfC-0000xm-4A
 for 59786 <at> debbugs.gnu.org; Fri, 02 Dec 2022 15:29:40 -0500
Received: from pps.filterd (m0246630.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 2B2IMdvB027821; Fri, 2 Dec 2022 20:29:37 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : subject :
 date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=corp-2022-7-12;
 bh=XlX+nVgj7ENySOgZ8J0TXM5y9a/4yu7fpsQgc59Qvnk=;
 b=zztorPLAR+iE4Mr6C/MmCHEZvL/DJCgrDfHiBJcrl+rsVH1kRYERW1+aaHc14j4QyNqA
 ODaxygpME3cNvAA2xcIkculKi62+gpHQTxHIfqP5iNyIfFWrBSoeijO8wBa0YHqjEM1z
 4wzM2g3rTvs8uFyzwOJEDdQOeshBQ76/xm2SvdH2hqabvw2vGIH3etFiqG09g3OQc3IJ
 aVb9khjMEYcBFDarC1Pc2P5MjRT4hcdfhlvQuEufHA4422l7lGlmyMICnTj9MsogRNr/
 ir43LtpJumxVZe9Z38zYTjlzX5c/eNnbKZFcmaGPL7wAYskFhmO9n8z+ukzV87JQ106C bA== 
Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com
 (phxpaimrmta02.appoci.oracle.com [147.154.114.232])
 by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m782j2gf3-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 02 Dec 2022 20:29:37 +0000
Received: from pps.filterd
 (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
 by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5)
 with ESMTP id 2B2JSY0F002774; Fri, 2 Dec 2022 20:29:35 GMT
Received: from nam11-dm6-obe.outbound.protection.outlook.com
 (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174])
 by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id
 3m398dh43w-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Fri, 02 Dec 2022 20:29:35 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=gJSQbkClnEsrUswRB7qpXQw/xyTLFUsGOulf3Tvd1Bblus5DtvLrLxRiZLF68Og3npHB3H1wm39noizGHoPnSnfhpErnKUnv6EcNPgecCtDLllZ7gPFAyBV1+tVDkiwwaYintCZGeR3XOuKNnOXLyPBThZJ55go6MR/tlKmju/z7HCvKqkU27dXx5zddMDJYTMBaRJGAjC7nsaZY5pqd6mBpldDYfKx1AzQcPZPBnrsHdOqWGb6lXdYi+UmFufUf3jHnWL8epY89ZzWYWa4PTRqURmHe9OkvjMz3T4P7a2gP3ggSDyd9Kbf4TpIV+H6Zopjh1hfdB8/svESyvHADdw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=XlX+nVgj7ENySOgZ8J0TXM5y9a/4yu7fpsQgc59Qvnk=;
 b=IJZc21MtAJOyZIHDU9Ze6Hpr6RGP2fzocSsrDWvCw6wRqqOXA71oVXg4E0aq9Ted6HEZwhmd6Xr4PAl8muzNwDLXb4N6ODFh+EW01gSrRYHhN2Kk0UMc8X3x75au+1LYSu4wabfyhH4vGTVPRRI5fTFDbsSZoIfqIxJs7d4/bMLjoHRGs3yqV1CIZ5AnxYIQRsg6mxKb6Bl+PNBiWNFE3YMyqxkRwofIqHkNvGbr9mSs81fgZeOh1JoQkExD12JnpsqSZSS7hwB8J9IefzZXDQdnL99KUxjyts88rFyXecT8/weitspJSdKmou/r1Ki+KKic5FzE+8LwDEQ/H2irHg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=XlX+nVgj7ENySOgZ8J0TXM5y9a/4yu7fpsQgc59Qvnk=;
 b=GY8qGqEK8VuY+Chvef2kt276Nna5dMdTO3kDqOymwo5AiW7t8G2Fr6hvfOhvbcwEm5tGGtIaXNQnLjVLwHLw0xiog9OrCbtciq2T2oQdS4nb1kyoktsSZoqAsdwld1qFDh5OXsqrqDzW27UoQsbD3Fh4cluKs2biB9oD+KAoafw=
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19)
 by SJ0PR10MB4542.namprd10.prod.outlook.com (2603:10b6:a03:2da::19)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Fri, 2 Dec
 2022 20:29:34 +0000
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::6951:297b:f3d5:2588]) by SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::6951:297b:f3d5:2588%9]) with mapi id 15.20.5880.008; Fri, 2 Dec 2022
 20:29:33 +0000
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, "59786 <at> debbugs.gnu.org"
 <59786 <at> debbugs.gnu.org>
Subject: RE: [External] : bug#59786: Allowing arbitrary expressions in
 cl-labels
Thread-Topic: [External] : bug#59786: Allowing arbitrary expressions in
 cl-labels
Thread-Index: AQHZBoakAgisaWaNr0CrfbRaI7z0Iq5bCZkA
Date: Fri, 2 Dec 2022 20:29:33 +0000
Message-ID: <SJ0PR10MB548834A901B2B0201AB5B70FF3179@HIDDEN>
References: <jwv359xr3oy.fsf@HIDDEN>
In-Reply-To: <jwv359xr3oy.fsf@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|SJ0PR10MB4542:EE_
x-ms-office365-filtering-correlation-id: f20760a7-5502-4731-451b-08dad4a3ec6d
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 7JtDBzRQrjsB/4q4D5WCYhWDpaPNi1yBuNY+1rAi+itKC4B2yzSqLHqk61aYlBHgJtbXhQ20RlKnzZWXAVdlND6SWS5RXfG4ulaKnsDn3Ph5WR7+UKDWCIad+LfqnQ/y9RlpIZ9CeUS3dbpyNB02jMPm8SyiSRJxlbl6vW1YnDq5Hcf7UZhS1d/VYQXlypANzd9dwlhirIJn8Zd7ug3bjIC6iIW5y9Np1PYwfMZN2eXYyH8iPVIu9v94vghA9ahH3MoymFIbYy8VU+g4HjHgWAtccz1jgXBrFjHcFGTytLaRi4d2yyDLqC0g3irh4SlgxG1DERARAQH9aD3OuC98R9x6XPlR2LrBUc7vX52m8G9g0OMZctEU+yGHT94kuvjT0sv4FaJHMEhypU3GPULhJTRqjNg7YSlQ6NGrGBg991y353dowUKZiu0TXr765LGX1oTCKwjPyu+u717OIIDGlh/dAsgO+KwgMk+JELIXGWUCHWGy8GjLl7CcqE+Gv78hy7ZnvSoyFxXi2bD96TuF71mn6w61fAdJO0mdRcPYuK7ZV+tr54fnxShW0fu/fggVfQnCUgoYpSyS4UkszPHX0HPER0E+KN6BPoon6llHz9AP77myt3yTRI33AG4SADMXE/Rls5wRHAIIKJVHAWyiQB/CaZXCghQ3pD8ztEhhzpg9Kvson2U6j/qo8FcDvF0aIwLRzLUlLy3rgCVbLrGBDg==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230022)(346002)(136003)(366004)(39860400002)(376002)(396003)(451199015)(66556008)(2906002)(41300700001)(4744005)(5660300002)(44832011)(38070700005)(122000001)(86362001)(66446008)(110136005)(66476007)(296002)(71200400001)(38100700002)(478600001)(316002)(33656002)(66946007)(8676002)(52536014)(64756008)(55016003)(76116006)(186003)(9686003)(26005)(6506007)(8936002)(7696005);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8IFjnS0i1os+cGBhC8LHUSvv+ubcvTWTvpscnI1knLLzCTbUSUfHmr2lx0sy?=
 =?us-ascii?Q?GqztURE/A2bXbfcf4XDvRleuk4sHFjCLhCSoiKH5ujQGsYK169GH/wwuSCYN?=
 =?us-ascii?Q?Eta90qEjDlZSTmSCuQnInCjoFaqTPECee6Alz3Dd2wCkdB0+b9e5sbGZTXwh?=
 =?us-ascii?Q?f+i+pNfp7oN+VM7pIGa/DKYxzxtZ5tiwETsMMVyu6SKbvVTmfSt7y8NQFXtP?=
 =?us-ascii?Q?I9JD1dsuOVh1Dnk22UBJ4RuUavHNa61dATUnC8Q/o7dzs0utSbbxcfTefEnv?=
 =?us-ascii?Q?sOUXJhMnXbMPGW0uh5T8TiohVdgiX8QG/i0w3Eqrt06f8R4+4EnTRDKDWpBc?=
 =?us-ascii?Q?HcnXUr5CgELUybqITBatGnv1F8kITubOBPvnurIQFQTnkl4UDbINZM6Iu53r?=
 =?us-ascii?Q?Fds1bgfFgaEf/v1/yCmbvseuJ2lT2OX+E+A68+l/RnlirnI0BRyMyJvKJmLL?=
 =?us-ascii?Q?TOAgoBuoFThhH5pHg2Qpr2zA0Y8fG3az42AtwrdxPDIXc1uq1Wbv73FHSf55?=
 =?us-ascii?Q?dUpYNPmbNe42TMTp0/FR3A+L6E5lbJ5wqGgkZHAk4+kDyqAHTEKuP/D30hls?=
 =?us-ascii?Q?PFErNTCm9PHi5Nh2yIM0sTL9fwfJfmKQx7HvT8YP370zuivV6cMBRV+01jbh?=
 =?us-ascii?Q?DBMJvrFKKqgkiI+l6yyVRAx1gGOV26D09nZfYSG95z7QK+8LgzTcUdXu4MFB?=
 =?us-ascii?Q?K863GlvPLUUB4n8ZeqoSZHorcWOL/8mYbw3HqEMEcuRMc/EM405po6bJQbwl?=
 =?us-ascii?Q?HgDFML5QQK9PPMcrz87xZT6xCb1YwbFKwHxu5U5rydviCNqPr13+wlqWVp3+?=
 =?us-ascii?Q?HtS5VRrLt3ijWcVo8Ggmn0MiGK5OyAQrDq7VeDCuxKW86Z1KfbVmGhgQyWMI?=
 =?us-ascii?Q?58Bl7fl1emFLe7s/2HY2kcjDe0Ir9g/8KJCvRX2x4DQjjqT0/uUdZ4wqlQSL?=
 =?us-ascii?Q?X3cJrTSfSF7Z9BoOfRKl+46sqe30OGyXNwll7ZJ2//k4pBBtpKDgpSX9U/hZ?=
 =?us-ascii?Q?sYWqj4FiKogeeeJyd6EMgggLjhEQNiTUQY9HM4crd3gYlmxsMDZkkJd0UvZZ?=
 =?us-ascii?Q?wxV6GBhjdk21RRWC8BUVEbEiVxA2BKOfLPti90TPpsrwOEU2+gP4T2ZFt8nJ?=
 =?us-ascii?Q?/ta3bXJO5HluxIrEtez3DuXbN/SuTc5jutL7Tg+fLljI09egq+wVQyfzCo8m?=
 =?us-ascii?Q?6xH2Es0SXAyGk2koDHG+oMIqLk3gW/N0sgMPr42UZWnpjwNfIysdz0M4nkOH?=
 =?us-ascii?Q?LC6lhGbFFcYVM7KRU2AJ0PmjKib8vle4br431QZBtI+tH5HQNHzglwOcu95f?=
 =?us-ascii?Q?fIbCCfUBaeXYmfBdk1aqgpX5zRpDhBp3fEQ6CXw3AsD9wOHthY1vB2yE4SHA?=
 =?us-ascii?Q?39fTH7+RDbbis+D+QC/r5h6a/enL3Y/tH4mQUezRFMiwiM74OiTZnaVyMvZp?=
 =?us-ascii?Q?gobx+UCt9EYZVVxIOAhRIOf3Cq+S7sschuqmOCRrB/PBkg/l46hgDhP4IvNu?=
 =?us-ascii?Q?u/EFUmWyF8rPsSLOK8s2tevGXC2TTElSbhI6zdXJzm9aRO1f8wpduIWl9jLn?=
 =?us-ascii?Q?Z45ibHuzRD+KBCZ9S1qnVpHd4Gdh9xH971bO2Ile?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: NV3iKA+XSainmyLYdCoX+iGGRbIzWyN4zRpru53wiB0c0BluXBNP3UabatSDo6N1NzMzZVmsU2GDyyFnowW++E0YrSMWsnUhXvBbuEx7XsasTdCQ7MkylPHNMDk1sMsrmLDvXAnN6SCqRgI5NJmBLL9XR3y8ABKQdhlke4Hh4qrKhaGyRO0fPI1LQ3GWTkQwmgaBZ3Cr2iMFXutNRgJdLUj0jaMEPOBttbcezq9m3OR6Zb7l7fGzZ28f6bwy23PRIgDDwqm4HgVtvQui2VBVwWOl7X9kaqJC/AqoWLmQTBn3sk3hK7QmXaLOd2wYwHL0QQlwBL6flODRC4gMb6HATqK1bRDaOLeLajlU7iQQGPq21Zu9n27cU3MIBAVu3H0ITkv6vWNJWXgH326R4yJnRQ2h4f9tqtzeI65N5r0nUeEHa/qgCPNKpd2jUy1tG6kxo7mX8xwTLYpneWkoqNkmxhy5rSTeElGIamcHBzBRpF1TzWXci41DTeXUvA6iqEjXyX89obFAw10EX/Gg8UmPt1/IKVz54Dy3WNiUYe4aY8KChKlTURHo4KeuBxCWhqHiZLCxvGh6Vm8o0WD2CeuVRicC4Yhu9zfvylPqQRt0LQBHmfyd6iGRhyz/l1R1EX18QGwmLLzW7G7lGOnbMInaiNU9mnffxJTTIXlR7zINtZNc6AihMTfHWrEvyl3mYfUTynetuF7lx/LaRxFLX3T4Ajt5nHMT3T4xeHLu1QgZclAoKu2HviGA30ZeoLyBa9KVYtFYIfBFb6pByipH+uank6eTqz8144is0Aki0YJ54X6qc/oJxzl76MLID5K01OA9
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: f20760a7-5502-4731-451b-08dad4a3ec6d
X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2022 20:29:33.7220 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: /03NPh9N5dBd31gnGC+/RZQvpcC0n+RnoE/6tdm2pZtwnwjMl45rnoisMgboxUuDufW0r/pa9IR/wHrcSp92Eg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4542
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1
 definitions=2022-12-02_12,2022-12-01_01,2022-06-22_01
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0
 suspectscore=0 phishscore=0
 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=649
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000
 definitions=main-2212020164
X-Proofpoint-GUID: VjRkTDJJYg0MICzSf4of2VGWOdThHlqH
X-Proofpoint-ORIG-GUID: VjRkTDJJYg0MICzSf4of2VGWOdThHlqH
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 59786
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> I'd like to hear what other people think,

FWIW, I think that our CL emulation library
should emulate CL.  (Shocking, I know.)  In this=20
case, `cl-labels' should emulate CL's `labels'.

It's bad enough that we've added some non-CL
stuff to our CL library over the years (instead
of putting it elsewhere and not giving it prefix
`cl-').  It's worse when we co-opt a CL name to
do something other than emulate the CL thingie
that has that name.

It's fine for Emacs Lisp to add whatever we like,
including a `labels'-like function that acts
differently from CL `labels'.  What's misguided,
IMO, is for us to use the name `cl-labels' for
such non-`labels' behavior.  Add a new function
for that, without prefix `cl-'.

I'd even like to see us backtrack on the other,
divergences from CL emulation that use CL names=20
(but with prefix `cl-').

Just one opinion.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59786; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Dec 2022 19:44:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 02 14:44:35 2022
Received: from localhost ([127.0.0.1]:48472 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p1Bxa-0000V1-Ko
	for submit <at> debbugs.gnu.org; Fri, 02 Dec 2022 14:44:35 -0500
Received: from lists.gnu.org ([209.51.188.17]:36754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1p1BxX-0000Uv-Ki
 for submit <at> debbugs.gnu.org; Fri, 02 Dec 2022 14:44:33 -0500
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 <monnier@HIDDEN>)
 id 1p1BxX-00027L-5v
 for bug-gnu-emacs@HIDDEN; Fri, 02 Dec 2022 14:44:31 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <monnier@HIDDEN>)
 id 1p1BxU-0003nD-JI
 for bug-gnu-emacs@HIDDEN; Fri, 02 Dec 2022 14:44:30 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 969C0100178
 for <bug-gnu-emacs@HIDDEN>; Fri,  2 Dec 2022 14:44:25 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 40341100143
 for <bug-gnu-emacs@HIDDEN>; Fri,  2 Dec 2022 14:44:23 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1670010263;
 bh=ygG05gcLZ+SDo7E6pzC9NP8ROSld7EA8xL1cemA/NfE=;
 h=From:To:Subject:Date:From;
 b=SPYLWX987WABGSL7zjz6c6OJ4LkAFm1kART330GTuKCVXHNrppaJQJQxF+Q79KNF8
 AH6Q42uBl+dxP7wAff1jPfoAJZRyFgnd+66+SOgp2hw/fuAWI6a6Lc1akUuWPJOWSM
 NyheTgl73HhwAI0wG3n+zBU9Ue2NYFjJnfKl71rf/wY9W0iuetdcf++dG9w7J6MBWX
 m5PNwsyWebX05DLuIaU4M/Id4R4nOuw1AMzuQXDEBR4dFeeLPUatOI8LiPybLztIuj
 bB6MOqHTW8Y1zs7L2077cRVnZ2dyrP7yS4Ln9zJVZurSeti9qgDkphRRN3+BLnyZ6u
 I+N43NC+Nhdww==
Received: from pastel (unknown [45.72.193.52])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2A8D3122D8E
 for <bug-gnu-emacs@HIDDEN>; Fri,  2 Dec 2022 14:44:23 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Allowing arbitrary expressions in cl-labels
Date: Fri, 02 Dec 2022 14:44:13 -0500
Message-ID: <jwv359xr3oy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.311 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
Received-SPF: pass client-ip=132.204.25.50;
 envelope-from=monnier@HIDDEN; helo=mailscanner.iro.umontreal.ca
X-Spam_score_int: -42
X-Spam_score: -4.3
X-Spam_bar: ----
X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Tags: patch

I have found some circumstances where I'd like to write things like:

    (cl-labels ((f1 (if blabla
                        (lambda (x) (do one thing))
                      (lambda (x) (do another thing))))
                (f2 (if bleble
                        (lambda (y) (do some thing))
                      (lambda (y) (do some other thing)))))
      ...)

I.e. define two, mutually-recursive functions, but where I want to
perform some computation before "building/returning" each function.

I could rewrite the above to

    (cl-labels ((f1 (x) (if blabla
                            (do one thing)
                          (do another thing)))
                (f2 (y) (if bleble
                            (do some thing)
                          (do some other thing))))
      ...)

but then the `if` tests are repeated at each call.
I could also rewrite it to

    (letrec ((f1 (if blabla
                     (lambda (x) (do one thing))
                   (lambda (x) (do another thing))))
             (f2 (if bleble
                     (lambda (y) (do some thing))
                   (lambda (y) (do some other thing)))))
      ...)

but then I have to use (funcall f1 ..) and (funcall f2 ...) instead of
just (f1 ...) and (f2 ...).  I could add a (cl-flet ((f1 f1) (f2 f2)) ...)
but that's inconvenient, especially because I'd have to add it in
various places.

So I'd like to propose to extend `cl-labels` in the same way that
`cl-flet` was extended to allow each function to be defined by an
expression that returns a function rather than by "args + body".

One option is to use the same approach as I used in `cl-flet`,
i.e. allow each binding to be either

    (FUNC ARGS BODY...)    the normal existing syntax
or
    (FUNC EXP)             the new syntax

After I introduced this in `cl-flet` it was pointed out that it was an
incompatible change since BODY... can be the empty list.  Another option
is to use a syntax like:

    (FUNC = EXP)           the new new syntax

which should not suffer from such incompatibility since ARGS should
never be of the form `=`.

The patch below uses this "new new" syntax (and adjusts `cl-flet` to
also support this new new syntax).  It still lacks a NEWS entry (as
well as updating the CL manual), but before I do that, I'd like to hear
what other people think,


        Stefan


 In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2022-11-29 built on pastel
Repository revision: 4254a4a71d5d04cfcefaedfefe5d22af55650a6a
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment; filename=cl-labels.patch

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 43a2ed92059..cc8c98f2264 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2028,11 +2028,11 @@ cl--labels-convert
 ;;;###autoload
 (defmacro cl-flet (bindings &rest body)
   "Make local function definitions.
-Each definition can take the form (FUNC EXP) where
+Each definition can take the form (FUNC = EXP) where
 FUNC is the function name, and EXP is an expression that returns the
 function value to which it should be bound, or it can take the more common
 form (FUNC ARGLIST BODY...) which is a shorthand
-for (FUNC (lambda ARGLIST BODY)).
+for (FUNC = (lambda ARGLIST BODY)).
 
 FUNC is defined only within FORM, not BODY, so you can't write
 recursive function definitions.  Use `cl-labels' for that.  See
@@ -2055,8 +2055,12 @@ cl-flet
         (if (and (= (length args-and-body) 1) (symbolp (car args-and-body)))
             ;; Optimize (cl-flet ((fun var)) body).
             (setq var (car args-and-body))
-          (push (list var (if (= (length args-and-body) 1)
-                              (car args-and-body)
+          (push (list var (cond
+                           ((= (length args-and-body) 1) ;Obsolete syntax.
+                            (car args-and-body))
+                           ((eq '= (car args-and-body))
+                            (macroexp-progn (cdr args-and-body)))
+                           (t
                             `(cl-function (lambda . ,args-and-body))))
                 binds))
 	(push (cons (car binding)
@@ -2203,12 +2207,13 @@ cl--self-tco
 ;;;###autoload
 (defmacro cl-labels (bindings &rest body)
   "Make local (recursive) function definitions.
-+BINDINGS is a list of definitions of the form (FUNC ARGLIST BODY...) where
-FUNC is the function name, ARGLIST its arguments, and BODY the
-forms of the function body.  FUNC is defined in any BODY, as well
-as FORM, so you can write recursive and mutually recursive
-function definitions.  See info node `(cl) Function Bindings' for
-details.
+BINDINGS is a list of definitions of the form either:
+- (FUNC ARGLIST BODY...) where FUNC is the function name,
+  ARGLIST its arguments, and BODY the forms of the function body.
+- (FUNC = BODY) where BODY is an expression that evaluates to a function.
+FUNC is defined in any BODY, as well as FORM, so you can write recursive
+and mutually recursive function definitions.
+See info node `(cl) Function Bindings' for details.
 
 \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
   (declare (indent 1) (debug cl-flet))
@@ -2226,17 +2231,31 @@ cl-labels
     (unless (assq 'function newenv)
       (push (cons 'function #'cl--labels-convert) newenv))
     ;; Perform self-tail call elimination.
-    (setq binds (mapcar
-                 (lambda (bind)
-                   (pcase-let*
-                       ((`(,var ,sargs . ,sbody) bind)
-                        (`(function (lambda ,fargs . ,ebody))
-                         (macroexpand-all `(cl-function (lambda ,sargs . ,sbody))
-                                          newenv))
-                        (`(,ofargs . ,obody)
-                         (cl--self-tco var fargs ebody)))
-                     `(,var (function (lambda ,ofargs . ,obody)))))
-                 (nreverse binds)))
+    (setq binds
+          (mapcar
+           (lambda (bind)
+             (pcase-let*
+                 ((`(,var ,sargs . ,sbody) bind))
+               (list var
+                     (named-let loop
+                         ((mfunexp (macroexpand-all
+                                    (if (eq '= sargs)
+                                        (macroexp-progn sbody)
+                                      `(cl-function (lambda ,sargs . ,sbody)))
+                                    newenv)))
+                       (pcase mfunexp
+                         (`#'(lambda ,fargs . ,ebody)
+                          `#'(lambda . ,(cl--self-tco var fargs ebody)))
+                         (`(progn . ,exps)
+                          `(progn ,@(butlast exps) ,(loop (car (last exps)))))
+                         (`(let ,bindings ,exps)
+                          `(let ,bindings
+                             ,@(butlast exps) ,(loop (car (last exps)))))
+                         (`(if ,exp1 ,exp2 ,exps)
+                          `(if ,exp1 ,(loop exp2)
+                             ,@(butlast exps) ,(loop (car (last exps)))))
+                         (_ mfunexp))))))
+           (nreverse binds)))
     `(letrec ,binds
        . ,(macroexp-unprogn
            (macroexpand-all

--=-=-=--





Acknowledgement sent to Stefan Monnier <monnier@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#59786; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 13 Jan 2023 14:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.