From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: Is this a bug in while-let or do I missunderstand it? Date: Sat, 9 Nov 2024 20:15:39 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31743"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "emacs-devel@gnu.org" To: arthur miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 09 14:16:42 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 1t9lKS-0008Ac-Da for ged-emacs-devel@m.gmane-mx.org; Sat, 09 Nov 2024 14:16:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9lJj-0007FK-VW; Sat, 09 Nov 2024 08:15:55 -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 1t9lJh-0007Dl-L4 for emacs-devel@gnu.org; Sat, 09 Nov 2024 08:15:54 -0500 Original-Received: from mail-ua1-x92a.google.com ([2607:f8b0:4864:20::92a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t9lJg-0004dW-5D for emacs-devel@gnu.org; Sat, 09 Nov 2024 08:15:53 -0500 Original-Received: by mail-ua1-x92a.google.com with SMTP id a1e0cc1a2514c-84fd616acf0so1393776241.0 for ; Sat, 09 Nov 2024 05:15:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731158151; x=1731762951; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ORDczCOq3TfybCqpRq4zpO7847DD1dTs5LLh0O7GRYM=; b=SdP37GflY83XSBm0YuZOTCix0+0RuAqTThmzzVwQxC4sSzxuVo/oMM9EIGDzOIeE18 II+XUtmiI7DwNcKKe1KYyY6gpHM8n0zH2OmOeYVPtRbdHbQdhKMQGvHGGdIpMhWdtRaY 6EX3BVik4jk/jWLx6KdoozV43Z8KtRBDn2XAsTh3aSqZcsTSHMGTXm3wawlnVRVwSp+j BnlZ0gO7NtBIcOFYPnfKazTX6A8bXAQzc1d/Hfd4yED4yo/4nLz/BmU2tBZjmo5hWAsq Y4IFzYw0R3bZ8Fce3/2R6m/ojndBPQkvrYQsoXtBvJBq0vJIWCzAAlbGGSZaghRYHvrz fobA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731158151; x=1731762951; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ORDczCOq3TfybCqpRq4zpO7847DD1dTs5LLh0O7GRYM=; b=R1MfVX2djBqjJs1wr+uKR+ela8uE6Nvf1SzGux1uwzAqY5zdUHOMJgB7yiyWMpk4EK 5cE6fglpo4jJBoJtu21Q1i6LPR8DpwYdjujUvsFXAJF15+rnqUeuVuHLZSSTgTOg+bm7 gO4Igga8OgoaRz8xfOZNGowbswXd06TOf5Rt7QE+fKMqnwqbcrnMLe1lJYhhrz6sSxFg JKMgelJQ/oRqfQttdnB/RcVq3ndecCAuUOU9Yr98+NTtIgYXdIRGP+Vb8JiW01A61LNF Om2zzc/1VwTRMj6JwTuFWX40qjqstvr9E39dXfvTTd4oYj7QK2U00qZCMjKFFixjliqD rVmw== X-Gm-Message-State: AOJu0YwB3fKOTxB+Oc6x8tJIY2sCqWIywWG1yt94VJ1M1QsdKWy58npi LroS38B/N1HQlS2h5Cm4LU/qobqG4gUmM2xStQM24THUOvsLmYZD2ThB0tA8tPs0TcsvdGhE/px lyZWrBdsrXoEEX3e7VcTymG2U6ncK5qcsqdU= X-Google-Smtp-Source: AGHT+IF93GIwS0vTPE8qTYG1BS438Gj6EJwZmLdYElLq56ouGX5TXZQCYhIlNK/0RKzw8wv4wzgsx46HOhsh+QFLl2M= X-Received: by 2002:a05:6102:3a12:b0:4a4:7928:637c with SMTP id ada2fe7eead31-4aae1380702mr6506236137.8.1731158150742; Sat, 09 Nov 2024 05:15:50 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::92a; envelope-from=yurivkhan@gmail.com; helo=mail-ua1-x92a.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:325331 Archived-At: On Sat, 9 Nov 2024 at 20:03, arthur miller wrote: > > >> (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= variable. > > > >Probably not infinite recursion but infinite loop. > > > >Why would you expect anything else? =E2=80=98while-let=E2=80=99 is docum= ented 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? I expect the binding is writable *but* it gets re-assigned on each iteratio= n. > (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. This is what I expect: (progn (let ((run)) (while (setf run t) (message "running") (setf run nil) ; useless because =E2=80=98run=E2=80=99 will= be reassigned right next ) (message "not running") ; unreachable )