On 10/21/12 1:31 PM, Vadim wrote:
After reading the Borrowed Pointer Tutorial, I started wondering: why
should the programmer have to specify whether to pass function
parameters by-copy of by-reference?   Couldn't Rust just drop the '&'
sigil and let the compiler decide on parameter passing mode?

We tried this and it was pretty painful (the whole "mode" debacle). The problems tend to surface with generics, when the compiler isn't actually aware of the type (it's just an opaque T), and then it has to arbitrarily choose whether to pass by reference or by value (which have different semantics in borrow checking and so forth, so it can't just be a codegen decision).

Patrick

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

Reply via email to