emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this a bug in while-let or do I missunderstand it?


From: Yuri Khan
Subject: Re: Is this a bug in while-let or do I missunderstand it?
Date: Mon, 11 Nov 2024 12:13:45 +0700

On Mon, 11 Nov 2024 at 01:18, arthur miller <arthur.miller@live.com> wrote:

> As I understand it now, Emacs while-loop is a unique kind of loop, at least
> I have never seen a construction with such semantic before. The semantic
> of while-let in Emacs is that of for-loop or while-loop in C++, but where
> initialization of loop variables happens on each iteration
>
>     for (int i=0; i<some_bound(); i++) {
>         we can read i here, but
>         we can't write to it
>     }

Comprarison with a for loop is somewhat strained here. The while-let
loop in Elisp is directly analogous to this C++ while loop:

    #include <iostream>

    int main() {
        while (bool run = true) {
            std::cout << "running\n";
            run = false;
        }
        std::cout << "out of loop\n";
    }

and yes, it’s an infloop, too.

What you’re looking for, though, seems to be a while loop with a
break, which is expressed as a catch/throw in Elisp.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]