[rust-dev] 'in' for for loops and alloc exprs

Benjamin Striegel ben.striegel at gmail.com
Thu Jul 25 13:46:31 PDT 2013


> If we did that, we'd lose the ability to break or return, since 'do'
doesn't follow the for-style loop protocol.

I'm perfectly happy with that; the `times` method was never about complex
control flow, just simple repetition. `do 10.times {` is a delightfully
self-explanatory contract.

And just as evidence that `do` notation is useful beyond `spawn`:

    $ git grep "do .*{" -- "*.rs" | wc -l
    2019
    $ git grep "do .*spawn" -- "*.rs" | wc -l
    274

> we're likely to switch that to a macro call that passes
explicitly-captured arguments into a thunk struct that owns the explicit
captures

I don't remember seeing much of this idea in the meeting notes, but I do
remember seeing it mentioned in these blog posts (for those who want more
context):

http://smallcultfollowing.com/babysteps/blog/2013/05/30/removing-procs/
http://smallcultfollowing.com/babysteps/blog/2013/06/03/more-on-fns/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20130725/45bdff01/attachment.html>


More information about the Rust-dev mailing list