On 21 June 2014 11:10, Nick Cameron <li...@ncameron.org> wrote: > I wonder if we could come up with _some_ > design that would be better than the current one.
The reason the ugliness is the repeated clone calls: let x = Rc::<int>::new(1); ... foo(x.clone()); bar(x.clone()); last_x_use(x); In this pattern the x is repeatedly cloned to pass it as argument that will be moved. The ugliness can be eliminated if x as the local variable can be annotated to tell the compiler to clone it before passing to functions. I.e. something like: let autoclone x = Rc::<int>::new(1); ... foo(x); bar(x); last_x_use(x); Another possibility is to allow for move-in-move-out params that moves the the value back to the caller when the function returns forcing the callee to use the clone call if it wants to store the argument for a later use. _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev