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 14:44:45 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_DU2PR02MB10109C688CA799A95D028E4A1965E2DU2PR02MB10109eu_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17499"; 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-0004Ie-4q 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 1t9msS-00009F-1D; Sat, 09 Nov 2024 09:55:52 -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 1t9mhm-0000NU-KW for emacs-devel@gnu.org; Sat, 09 Nov 2024 09:44:50 -0500 Original-Received: from mail-vi1eur03olkn20810.outbound.protection.outlook.com ([2a01:111:f403:2e0c::810] helo=EUR03-VI1-obe.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 1t9mhk-00067w-Tk for emacs-devel@gnu.org; Sat, 09 Nov 2024 09:44:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rtPCpyq0Jafhko53avQ1Tb6YgM1K/xWtKp4NO/XzA0iIdPsRS5vBU+O2vtZmDVqjptHTuRcM3F8cezIeVAvAiBu7fSLduYJtBWouQqNxrbyYUErYOFkvYwkzb4scnMFuy3qZEAcIFNyCRXPTgNWpRnpBRwvQnoCCSrbYV5y7qNn65/3wW78+oSTJ8eICTnx2gSsbFvuVJ5z+huLrBqE1Fdv0Dg6YyX86isOt48MVcNOYgQvpvB9mO8WrYR2teW4JNNuk7YPZfyocikh8oJOBj0FcyouNQmkMCvETdMRX6MIzjyHK6N9kz3dnJHw85VbwZsV91VAkKwLkZh1mx4XNQQ== 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=KAPpPDjpKk6jlR8q85uketu5vJHhibB3ODWqL06KTcU=; b=GDRut2sFfMnGRbq/PitiNRmmhrXcRfOBfJnLgPoX+1Db/V7043KBezak1og40hHvEQuRo+OXcxxDRB08FecezEtivJyZrdc3iENNXKAKQ3vMFljC2wywHrk7qqVrZrWKwZiTZIzHmSuc6qqNrwzKnRK99UjNLImDMHsLbgIhsw/bAC2/9W6zeNAS5t9qg7a4qmMmpkN/59oJV7zVRg0Qk6exvVJ6I+mpTS+IZgjBEY3Z7r/M4bhrm7AWgydT0NGOl5Fnz1fFvmSzxYZXlBCA8+Qfezw8KZHitZSN93apyaL+7hDm84MZgpgzCqQGcMXukXj0SO16F9RUA4xvqKZ4aQ== 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=KAPpPDjpKk6jlR8q85uketu5vJHhibB3ODWqL06KTcU=; b=rxi2TgRuHptL+UPfGGaw+AO1mVMWkW9vzvT26lFn8CPXOTUZy8uqCH1i6dK7pYusxIrknm3yrBe01fLl1RE5ucVQDZcFNcgMmAlmXn5V/27OkagKGvfhSygHkLumYNH9Xoiql5Cuc95zVBszXvCxqgZWPwIcx5GSMYRJwX6rKZU68m6XWY5Rw4rlmq1Sk9T+JULhN9YiKa0DehxMTQS7Y5AQBds1Jnd0wC5ZKVtrSR3FGRrWhcFSXbaLpNAhxO3lponcAdXB0P4onRf37G/vIciP527FwrnxO3eTQsoilR8oHMS/eAdzVHDo0Y44lkAA+dsGoUcqTX/cXJHmBP+9lg== Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) by GV1PR02MB11033.eurprd02.prod.outlook.com (2603:10a6:150:207::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.22; Sat, 9 Nov 2024 14:44:45 +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 14:44:45 +0000 Thread-Topic: Is this a bug in while-let or do I missunderstand it? Thread-Index: AQHbMfbIoZNom93mHkmQsSTvSCnRb7Kur/AAgAA0XUGAAAq2gIAAAU7JgAAF/YCAAAA4e4AABg0AgAALT/M= 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_|GV1PR02MB11033:EE_ x-ms-office365-filtering-correlation-id: edf63d74-4ffc-4b5f-0552-08dd00cd0de6 x-microsoft-antispam: BCL:0; ARA:14566002|19110799003|8060799006|15080799006|8062599003|7092599003|15030799003|461199028|440099028|3412199025|102099032; x-microsoft-antispam-message-info: =?Windows-1252?Q?n1rSc/EgHxClLtT2Q9OZtQgge3LZPpxSbTY2oMQf6kazuToG7aHUGN4+?= =?Windows-1252?Q?YUcCWBIXg4+b/Tsd15W3F+VavlibPd55vwuoDK0bHxAnIXD3UeocoXsj?= =?Windows-1252?Q?FIbl53kYeYvvrNG1S5b0eG9u9HmX13xVHCCdsiUzCxCLK9c7kQY5CRhW?= =?Windows-1252?Q?lhELI2HzQYcTvNuse1JfS/HxXYEcew6zwybs7jq5b7e8v2hJXA7DU2mx?= =?Windows-1252?Q?x2ch5us/BeVxRRfKor9KFMxE+jNbZSI9uZuck1i5gqd84a1oB1HRUvVh?= =?Windows-1252?Q?1ticheHcd6Xw6FgBoTjGbkdUPNpRwvwExdwrBzdyIlOoWzuTmzf5/ye8?= =?Windows-1252?Q?K+6Us9x9s5bglgyxSlgoGWSGFcxzgwB6bQ5J1uUq29ZHOzA9aSAs7kzf?= =?Windows-1252?Q?t3YP3hwa8qAjoEgiCaTlSP8gdZcp/w9BrEHrewwaKr3hsNDXgqY9osTD?= =?Windows-1252?Q?a0SWCw4nyC2ZZn9PIe/e+xql6yvbfLA9rNsrbPlgRyD7ChrZU6dTw61K?= =?Windows-1252?Q?WTltelIXHc6PrKpANisPjInK0vmPUpu5jQ8uRYqf91BGsUjW3nmqHaRd?= =?Windows-1252?Q?x9gPbAhudHnwNOlO+VcIfI0DWAyK1hABWuryAQShRgRkSYjlDEjjxBrK?= =?Windows-1252?Q?e x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?Il4wZhIBPtmsumlGYB5GD80Rgk4mHwY7I0FZj04Llb6ormqpZIOLT4LS?= =?Windows-1252?Q?kX3nL3AbefWcItJeFSWHapmMHaLVBgvSj0W3wtPGclmqSpzL9ZORcrt9?= =?Windows-1252?Q?bAx258l5LWdF5mASo2OrfW4nOKnYndkAt/S3wNTmQU//nOBQst3eG2V2?= =?Windows-1252?Q?zl6xnRLR4SnGhdy5d2hJ4ZphXh4S6dziqz6D1iW46/5WKywbVhXKFOth?= =?Windows-1252?Q?tlnBOSYWxmtU9Gxu5Fucxf28TZO30SmEUN6WolccvwGq0jMPB/yxtnct?= =?Windows-1252?Q?NHxMHVQh5ChxWaLHzzZVZDGlo3zDLJkzYAhHYFLZn+HcuV89bZlP1eh+?= =?Windows-1252?Q?Trob21iAV3kkt0tuaFTCJeUsPUuobc6I2AS2H8Xpmx5RY6WIQWv6y5YX?= =?Windows-1252?Q?Gcob6Xjcs+q4EpZ8PqusHx9gA8pcY9tRQNcqLz3Ym3hIfIKas53eB8dJ?= =?Windows-1252?Q?wBizryE3o1Uro5CTgy/ZPrv8m/cyXjzwXFVVflZpH+CPPPurm6am1nGA?= =?Windows-1252?Q?tAwMgveY+uQ5XKaEf/LzJY/hAZZOfQJwoxNQuJKcL49xBywUacs0FpUs?= =?Windows-1252?Q?u/Z1tNZU0m6ElxbQO+SlLz8NY8wbeDqyT0Amjb0h0dGDme1faliFZOce?= =?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: edf63d74-4ffc-4b5f-0552-08dd00cd0de6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2024 14:44:45.7662 (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: GV1PR02MB11033 Received-SPF: pass client-ip=2a01:111:f403:2e0c::810; envelope-from=arthur.miller@live.com; helo=EUR03-VI1-obe.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, 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:325337 Archived-At: --_000_DU2PR02MB10109C688CA799A95D028E4A1965E2DU2PR02MB10109eu_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable >But if it did it that way, the condition (init-form) would only be >evaluated once, and I=92d find *that* counterintuitive. Consider the ? I don't know man. Why would it be so? Loops conditions should always be evaluated in a loop, otherwise how should loop terminate? But I don't expect a loop to re-initiate all bindings from defaults each time it runs an iteration. It is both expensive, unnecessary and counterintuitive. Don't you think? >usual form of a while loop: > > (while-let ((run (some-condition))) > (message "running")) > >Do you expect that to evaluate (some-condition) once, then, if it=92s >initially true, run forever? That usual form of while loop works because (some-condition) is a function, and it obviously computes its condition based on the external environment. Perhaps you can set some global value in the loop to stop the evaluation, o= r perhaps (some-condition) computes the terminating condition based on some other volatile values from the environment. I don't see is that in the conflict to what I say. If you instead write (while-let ((run some-condition)) (message "running")) Than yes, the loop will not terminate unless you terminate it from the loop= . However, since we are throwing away the bindings on each iteration, we are also throwing away the previously computed binding, we can't write: (while-let ((run some-condition)) (message "running") (setf run nil)) Which to me seems counterintuitive. ________________________________ Fr=E5n: Yuri Khan Skickat: den 9 november 2024 15:04 Till: arthur miller Kopia: emacs-devel@gnu.org =C4mne: Re: Is this a bug in while-let or do I missunderstand it? On Sat, 9 Nov 2024 at 20:47, arthur miller wrote: > If it wasn't clear, the unintuitive part is that while-let was to > establish the local environment, so that we don't need to type: > > (let ((som-var (init-form))) > (while some-var > ... )) But if it did it that way, the condition (init-form) would only be evaluated once, and I=92d find *that* counterintuitive. Consider the usual form of a while loop: (while-let ((run (some-condition))) (message "running")) Do you expect that to evaluate (some-condition) once, then, if it=92s initially true, run forever? --_000_DU2PR02MB10109C688CA799A95D028E4A1965E2DU2PR02MB10109eu_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
>But if it did it that way, the condition (init-form) would only be
>evaluated once, and I=92d find *that* counterintuitive. Consider the

?

I don't know man. Why would it be so? Loops conditions should always be
evaluated in a loop, otherwise how should loop terminate? But I don't
expect a loop to re-initiate all bindings from defaults each time it
runs an iteration. It is both expensive, unnecessary and counterintuitive.<= /div>
Don't you think?

>usual form of a while loop:
>
>    (while-let ((run (some-condition)))
>      (message "running"))
>
>Do you expect that to evaluate (some-condition) once, then, if it=92s
>initially true, run forever?

That usual form of while loop works because (some-condition) is a function,=
and it obviously computes its condition based on the external environment.<= /div>

Perhaps you can set some global value in the loop to stop the evaluation, o= r
perhaps (some-condition) computes the terminating condition based on some
other volatile values from the environment. I don't see is that in the
conflict to what I say.

If you instead write

(while-let ((run some-condition))
   (message "running"))

Than yes, the loop will not terminate unless you terminate it from the loop= .
However, since we are throwing away the bindings on each iteration, we are<= /div>
also throwing away the previously computed binding, we can't write:

(while-let ((run some-condition))
   (message "running")
   (setf run nil))

Which to me seems counterintuitive.

Fr=E5n: Yuri Khan <yuri.= v.khan@gmail.com>
Skickat: den 9 november 2024 15:04
Till: arthur miller <arthur.miller@live.com>
Kopia: emacs-devel@gnu.org <emacs-devel@gnu.org>
=C4mne: Re: Is this a bug in while-let or do I missunderstand it?
 
On Sat, 9 Nov 2024 at 20:47, arthur miller <art= hur.miller@live.com> wrote:

> If it wasn't clear, the unintuitive part is that while-let was to
> establish the local environment, so that we don't need to type:
>
> (let ((som-var (init-form)))
>     (while some-var
>         ... ))

But if it did it that way, the condition (init-form) would only be
evaluated once, and I=92d find *that* counterintuitive. Consider the
usual form of a while loop:

    (while-let ((run (some-condition)))
      (message "running"))

Do you expect that to evaluate (some-condition) once, then, if it=92s
initially true, run forever?
--_000_DU2PR02MB10109C688CA799A95D028E4A1965E2DU2PR02MB10109eu_--