On 8/10/13 7:10 AM, Simon Sapin wrote:
> Hi,
> 
> Now that the for loop is based on external iterators, can we reconsider
> "for-else"?
> 
> Proposal:
> 
>     for i in iter {
>         // ...
>     } else {
>         // ...
>     }
> 
> The optional else block is executed when the for loop stops without
> exhausting the iterator, ie. when "break" is used.
> 

I spent quite some time in Python, delving into as much of the language
as I could, and for-else was not something I used. It actually caused me
a bug due to a mis-indented if block in the for loop.

I would suggest that perhaps for-else belongs as a macro construct for a
while to test adoption; if it proves useful and strongly adhered to, it
could be moved into the core language?

-- 
Regards,
Paul

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to