On 20 November 2013 02:07, Ziad Hatahet <hata...@gmail.com> wrote:
>> 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).

In the safe code there is no difference if the value is passed via a
copy or as &T. Also as I learned recently the Rust compiler already
optimizes &T parameters into T for small-sized T at --opt-level=3. So
effectively &T parameter became a notation for the most efficient
passing of arguments of type T.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to