On 09/18/2012 11:26 PM, Ziad Hatahet wrote:
On Mon, Sep 10, 2012 at 1:36 PM, Timon Gehr <timon.g...@gmx.ch
<mailto:timon.g...@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

I see. Thank you for the clarification.

Reply via email to