From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: arthur miller Newsgroups: gmane.emacs.devel Subject: Sv: Is this a bug in while-let or do I missunderstand it? Date: Sat, 9 Nov 2024 13:03:26 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_DU2PR02MB1010982C736CAE046316D34C2965E2DU2PR02MB10109eu_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17180"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "emacs-devel@gnu.org" To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 09 15:56:21 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 1t9mss-0004Ii-5t for ged-emacs-devel@m.gmane-mx.org; Sat, 09 Nov 2024 15:56:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9msO-00006T-OB; Sat, 09 Nov 2024 09:55:48 -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 1t9l7j-0006pW-0Q for emacs-devel@gnu.org; Sat, 09 Nov 2024 08:03:31 -0500 Original-Received: from mail-northeuropeazolkn190120001.outbound.protection.outlook.com ([2a01:111:f403:d200::1] helo=DU2PR03CU002.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9l7h-0002Tx-A4 for emacs-devel@gnu.org; Sat, 09 Nov 2024 08:03:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pQPgm3DYk5DzklHvEEQxdPJMGlppbEty7/0xih3WCqq9aTJw5ZXmtuHNwXPSd0IbGPxi2Yl5anf8DIdcQ170i2qy9kT0+dX+GzSaGviZh/nFSGfH9m3lpRcdIxh4FOUq0B7fpGD1emDIg8c83NUmO658I8RDNLkcU+jlH2rm9nzFVrXen9aebo99w5xZduKiTR/ZTG4sLrrUSR0xnCarPFMW6dP2OLfOMFXLxHYSnz6ZfPTOkd41MrrDJvcIANvemGq0IacVl6qfHmq1+vqAYub9DJ9Y6ZkjEQhsKF5QunEDlmcawAKHigyOhAtoQSw34dTXfoKjbXeEBdcALpjJhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=pM14fZHKBw0qSGBzPba4pSuTg4Ofs4uoGUnlcBFnYrc=; b=xmWcXUis/LpqCMgrofNBC0VbQWLGKb5Cg9M0MpaVhFNG4KGhwG59jEH24TKJGCq2aqF00hSyrmrsNCcKUsX3KO/1CN544V/tYzk86i4M2gFvyylwFghOnF2GGpt5+T41pCeqPJcF8O0+fUMnzuTPlKERQ+8Fl3CTYQkQgcioYJDr5ii08IBnlTdmcwVzxaRSdrSmjTS27glosWAYQNRptxqGPTk31d44bSytXB9f05vyq++7EIgBVBOXIJlxm+ZAnHu7BYLHy3KMaU0Be6lGeTlPWODmdY/0k3Zv4PKYEpWMHUU4w5hWpgAFQ+BRATffm68rfCar7fMkqgny9P6dKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pM14fZHKBw0qSGBzPba4pSuTg4Ofs4uoGUnlcBFnYrc=; b=MSjkcwjXo4mbeBNuS1XNDLtR3Yt+nrBDKLMQZ05hG0L69Blkq5bXVqGhDy9bz+9/0Gcc/VFpkJPNMkbhTs1RdLEScpc638AKDl2oeJ1Gor9nZWzsaxdV7YLlXiLF6RpXibHzkqvi2bUFqTBE+4Gc/XgpHq0IXO9I4eHsqv9YW+TMJlM3yCeeXjkyfKAyHVK8D1cacR1D3hM2cIz3xXXX/YWpQsg6gWWqn8S4DmnaDPuOHc2e6gVZlzlffBvcHXif1yS5zUzz/6rpX4WyzieXMkOKK4tzTsMidHfJ597dBYJp/jmzf+B+AgmGFTOeDGESqxHx3qyoYCqF79bB/jbmCA== Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) by AS2PR02MB9047.eurprd02.prod.outlook.com (2603:10a6:20b:5f4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.25; Sat, 9 Nov 2024 13:03:26 +0000 Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::f3c9:d4cb:290:d487]) by DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::f3c9:d4cb:290:d487%4]) with mapi id 15.20.8137.022; Sat, 9 Nov 2024 13:03:26 +0000 Thread-Topic: Is this a bug in while-let or do I missunderstand it? Thread-Index: AQHbMfbIoZNom93mHkmQsSTvSCnRb7Kur/AAgAA0XUE= In-Reply-To: Accept-Language: sv-SE, en-US Content-Language: sv-SE x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DU2PR02MB10109:EE_|AS2PR02MB9047:EE_ x-ms-office365-filtering-correlation-id: 82fe0db3-6c2c-4f47-3661-08dd00bee65e x-microsoft-antispam: BCL:0; ARA:14566002|8060799006|7092599003|8062599003|15080799006|19110799003|461199028|15030799003|3412199025|440099028|102099032; x-microsoft-antispam-message-info: =?Windows-1252?Q?MISiuTRaGh+QAUKXC8e7nMGmpFNR5pYpgIF7Likup4rm51zY0eCIWy8H?= =?Windows-1252?Q?swdDu6og8t93Nxobrp4nxfd7n6s12Ru5K7dX7OmdHeu8LO37HhSY3zJW?= =?Windows-1252?Q?Plee8r8g8Mj1sWl5Q2oWhlOuklD/Yj8qtaEFdP6aBEiYe8z/hhcNHbCp?= =?Windows-1252?Q?cbgkbN/TFU9BUKz/ITeyZ6cPpuBtGtlOsR+yp6Wm5wBNOGL581CYl/XW?= =?Windows-1252?Q?9XKB3lQSmC4+jVnuiTPcisdBr3e5yK8LA8qt0MSn5fuF5LGZ2Hr+o7cx?= =?Windows-1252?Q?f7sMQ/hmU/ds37777eCgkqT0D8L6CIHnVRnd2NgllJ5AivZDzdyWePKS?= =?Windows-1252?Q?2VsW04U3yydMhO1ZOCaGSEcYCkZ/Ww0Qfw7VhgDsL5THziFX/gcuwoWc?= =?Windows-1252?Q?rnqeAci6nRjyqLizYB9+H7NCB7a7orWYXbQa4uY+epPrYXdqfAr2lUwe?= =?Windows-1252?Q?j51SwCrI/Hc0sEfzZgS/4m8FtBV7KjheD18r2wm0kFz68v5KQZI9kccb?= =?Windows-1252?Q?h07vX8uqMjZiurXmO/87F++tx5Kzi5U0Dxp6XIz8tXbg5QZRhR8YrZst?= =?Windows-1252?Q?BdDfzqo8v+7kXA4P0ZQ8lWPinK0VCLwQig9gXMn2pZN8i5xm0iwSsnqn?= =?Windows-1252?Q?v x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?OCVgNGLFsGv1v3tVhD/r4VDiML9bhiVaXiCiZX3cJ8Vfo+u1yJXxgizE?= =?Windows-1252?Q?wUSMkyWCiAJE4pG1DBY74947o8SthTXKYYQHgqxPkdazH8+dRB0s+XFz?= =?Windows-1252?Q?hGMGTr/SZtzqKZj5rJ8+AJ7LRNnfx+hW+A7x/eOrN91SanWOJOyJjviv?= =?Windows-1252?Q?SzdddtTZ2LAPmH3/oEuu1B9OY95NdydqoBnMZr8IKX9/gNyZbzeLIEhe?= =?Windows-1252?Q?tK4ZS852vLagDJzFSNoKqa7YCyAcx1a7T/Vv560asjT6oxmijbHWNBcr?= =?Windows-1252?Q?VJPT72e7hLD5g579CbFO6sd5okVxmELNzAjNGRC/2dgzrKn61/R0oCIa?= =?Windows-1252?Q?cI279vAE/852INaFRonEJ3O+G94wVN1pAya0Qhu1T0HUCaCeSAMu5iDf?= =?Windows-1252?Q?nH8FU/XFh7GftiAkhq31JnDVAERFbg6aD3iyUtIKgDNDLjMHMmwjXHfs?= =?Windows-1252?Q?rgNISY6Y/M8ArNfFnXJvlu6EPTjtZnszKjiIndSqjfhiT+PhTBSDqUQ/?= =?Windows-1252?Q?sCH5faYRcBe/sjiv3RYpF7YpSnFqjAn8nwb8IER8+pfICL8dmquP+uMi?= =?Windows-1252?Q?E2FQPPs5OqNMU8VhEn+fD4MemvQSKyOIpL7Tzw9FL80+bhoZhHOZ0qNy?= =?Windows-1252? X-OriginatorOrg: sct-15-20-7828-19-msonline-outlook-12d23.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DU2PR02MB10109.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 82fe0db3-6c2c-4f47-3661-08dd00bee65e X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2024 13:03:26.4832 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR02MB9047 Received-SPF: pass client-ip=2a01:111:f403:d200::1; envelope-from=arthur.miller@live.com; helo=DU2PR03CU002.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 09 Nov 2024 09:55:47 -0500 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:325336 Archived-At: --_000_DU2PR02MB1010982C736CAE046316D34C2965E2DU2PR02MB10109eu_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable >> (progn >> (while-let ((run t)) >> (message "Running") >> (setf run nil)) >> (message "out of loop")) >> >> It ends in infinite recursion. setf/setq have no effect on the lexical v= ariable. > >Probably not infinite recursion but infinite loop. > >Why would you expect anything else? =91while-let=92 is documented as: > > Bind variables according to SPEC and conditionally evaluate BODY. What should I expect? It does not says *read-only bindings*, it says bindings. Is it unreasonable to store a value in an established lexical binding? (progn (let ((run t)) (while run (message "running") (setf run nil)) (message "not running"))) That is what I expect while-let to be equivalent to. But in practice introduced bindings are "read only" since the current implementation of while-let throws out bindings on each iteration of while loop, which results in bindings being reset. If that was the intention, I think it is counterintuitive, but I doubt it i= s. --_000_DU2PR02MB1010982C736CAE046316D34C2965E2DU2PR02MB10109eu_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
>> (progn
>>   (while-let ((run t))
>>     (message "Running")
>>     (setf run nil))
>>   (message "out of loop"))
>>
>> It ends in infinite recursion. setf/setq have no effect on the lex= ical variable.
>
>Probably not infinite recursion but infinite loop.
>
>Why would you expect anything else? =91while-let=92 is documented as:
>
>    Bind variables according to SPEC and conditionally evalua= te BODY.

What should I expect?

It does not says *read-only bindings*, it says bindings. Is it
unreasonable to store a value in an established lexical binding?

(progn
  (let ((run t))
    (while run
      (message "running")
      (setf run nil))
    (message "not running")))

That is what I expect while-let to be equivalent to. But in practice
introduced bindings are "read only" since the current implementat= ion of
while-let throws out bindings on each iteration of while loop, which
results in bindings being reset.

If that was the intention, I think it is counterintuitive, but I doubt it i= s.
--_000_DU2PR02MB1010982C736CAE046316D34C2965E2DU2PR02MB10109eu_--