[rust-dev] On Copy = POD
vadimcn at gmail.com
Sat Jun 21 13:34:59 PDT 2014
This is assuming that foo and bar are fn(RC<int>), right?
In normal use I would expect them to be fn(int) ot fn(&int), unless they
need to retain a reference. And in the latter case I would make them
fn(&mut RC<int>) and clone() internally.
On Sat, Jun 21, 2014 at 10:52 AM, Igor Bukanov <igor at mir2.org> wrote:
> On 21 June 2014 11:10, Nick Cameron <lists at 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);
> 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);
> 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 at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rust-dev