On 11/08/2012 12:30 PM, Glenn Willen wrote:
On Nov 8, 2012, at 12:27 PM, Brian Anderson wrote:
With that in mind one might be tempted to `move` a into the `send_actor`
function, like `send_actor(move a)`. In this case that won't work because `a`
has been captured in a closure, and once variables are captured they are stuck
inside the closure (moving a variable out of a closure would leave a 'hole' in
the closure environment that make calling the closure a second time unsound).
In this case you have two options. Since you have a cloneable SharedChan the
easiest thing here is to just clone 'a':
Just to cherrypick this one interesting thing: This is only a problem because
we don't have one-shot closures, right? There's no inherent reason this
shouldn't work, it's just that we don't know statically that the closure won't
be called again, even though the programmer knows and intends that it won't.
Yes.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev