On 4/4/13 2:20 PM, Vadim wrote:
So I see all those borrow '&' sigils littering almost every function
declaration in Rust source, and I think that this is major contributor
to eye-soreness Rust syntax causes.   Since '&' is so popular, couldn't
Rust just make it a default?

For instance, what if the following rule were be adopted: "All unadorned
function parameters are implicitly assumed to be passed by
borrow-reference"?   Now, of course, this be inefficient for small types
like int, but that could be dealt with by specifying that types less
than N bytes in size (N perhaps being platform-dependent), are passed
by-value, except if mutable, or if adorned by lifetime of another parameter.

Ok, this is not a serious proposal, because I am probably missing a lot
of corner cases, but I would like to hear why this wouldn't work.

We tried this once ("modes"), and it was very confusing, especially when generics were involved.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to