Let stick to the semantic:
- while (<this condition is true>) = execute until this condition becomes
false
- loop = make a loop until a manual break = while true.

However, i think the compiler should check that there is an exit condition
in 'loop' block. I hate reading code with "while true" without exit cond,
this is the kind of evilness that shouldnt exist in rust!

And why not preventing any 'break' condition in 'while' block? Having a
"pure" while construction can make the compiler happy (better optimisation?)
Le 20 nov. 2013 22:13, "Gábor Lehel" <[email protected]> a écrit :

> Hmm? I think you think I meant that `loop` should accept a condition in
> front of the loop, like `while`? In fact my idea was sillier: just replace
> all instances of `while foo { bar }` with
>
>     loop {
>         if !foo { break }
>         bar
>     }
>
>
> On Wed, Nov 20, 2013 at 9:56 PM, Benjamin Striegel <[email protected]
> > wrote:
>
>> > This is an even sillier idea, but then what about keeping `loop` and
>> dropping `while`?
>>
>> I'm not sure this is possible to disambiguate in the grammar. You'd have
>> to be able to tell the difference between the infinite form:
>>
>>     loop <block>
>>
>> ...and the conditional form:
>>
>>     loop <expr> <block>
>>
>> ...while keeping in mind that <expr> can also be a <block>.
>>
>> _______________________________________________
>> Rust-dev mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>>
>
>
> --
> Your ship was destroyed in a monadic eruption.
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to