On 11/20/2013 10:37 AM, Brian Anderson wrote:
On 11/20/2013 09:14 AM, Niko Matsakis wrote:
On Tue, Nov 19, 2013 at 07:19:15AM -0800, Patrick Walton wrote:
The liveness analysis uses the infinite nature of `loop`, and it was
felt that special-casing the `true` boolean like Java does is a hack.
I personally like `loop`. It reads nicely. It happens quite frequently
that I have a loop that works out best if I test the condition in the
middle, rather than the front or the end, or where the condition is
something quite involved; in such situations, `loop { ... }` is
perfect, and `while true { ... }` always feels second-class. I
recognize this is silly of me, though. :)



I also adore `loop` and rarely use `while`. I write code like this constantly:

loop {
    match port.recv() {
        case DoSomething => { }
        case Exit => break
    }
}

Of course, `case` doesn't mean anything in this language...
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to