I'm trying to knock off some small bugs that have been lingering for a while. One of them is a change to the "capture clause" syntax, as described here:

    https://github.com/mozilla/rust/issues/2096

Basically the capture clause becomes integrated into the parameter list. The main motivation for this is that it integrates well with the sugared closure syntax. So you can write:

    let x = ~3;
    task::spawn { |move x|
        // use x in here
    }

In effect, a "parameter" that looks like `copy x` or `move y` copies/moves the local variable out of the environment into the closure. It's also good for multi-line function definitions, I think:

    let a_fn = fn@(
        x: T1,
        y: T2,
        copy w, move z) {

        ...
    };

I implemented this but wanted to do a final check before pushing to see if anyone had any objections.


Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to