> Personally I would prefer if & in Rust worked similar to const T& in c++

In that case, you would not be able to tell whether a function argument was
passed by value or by reference. I actually like this feature about Rust
(C# has it too with the `ref` keyword).

--
Ziad


On Tue, Nov 19, 2013 at 4:54 PM, Vadim <vadi...@gmail.com> wrote:

> So why did Rust adopt auto-moving instead of explicit moving?   If the
> second example had to be written as foo(move a) there would be no
> confusion.   The and the third example should arguably be sort(mut
> a.as_mut_slice()).
>
> Personally I would prefer if & in Rust worked similar to const T& in c++
> (i.e. for most intents and purposes you can treat a reference as a value),
> otherwise half of the arguments on each function call will have to be
> adorned with ampersands.
>
> Can we have it such that foo(a) would be guaranteed to not mutate or move
> a and require "mut" or "move" prefix otherwise?
>
>
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>
>
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to