>But if it did it that way, the condition (init-form) would only be >evaluated once, and I’d 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’s >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, or 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ån: Yuri Khan Skickat: den 9 november 2024 15:04 Till: arthur miller Kopia: emacs-devel@gnu.org Ämne: 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’d 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’s initially true, run forever?