On Mon, Sep 10, 2012 at 1:36 PM, Timon Gehr
<timon.gehr@gmx.ch> wrote:
Yes, Go uses explicit pointer types.
Regarding Rust, you are wrong.
I have built the latest Rust compiler.
import io;
fn modify(&a:int){
a = 2;
}
fn swap<T>(&a:T,&b:T){
let tmp<-a;
a<-b;
b<-tmp;
}
The `fn foo(&a: T)` syntax is being deprecated in favor of `fn foo(a: &mut T)`.
So your modify function becomes: `fn modify(a: &mut int)`, and gets called as `modify(&mut a)`.
Your swap function becomes `fn swap<T>(a: &mut T, b: &mut T)` and gets called as `swap(&mut a, &mut b)`.
So effectively, Rust also opted for explicit ref at the call site.
--
Ziad