On 25/07/12 21:11, Graydon Hoare wrote:
... the borrowed-pointer-using code looks like so: ...
Thanks for the clarification. That makes sense.

Can I have another clarification please. I have some rust code currently that looks like this:

// a type that should not be copied implicitly because it is mutable
class fat {
    let mut doughnuts: int;
    new(){
        self.doughnuts = 99;
    }
}

trait fat_methods {
    fn shizzle();
}

impl of fat_methods for fat {
    fn shizzle() {
        io::println("yo shizzlin");
    }
}

fn main() {
    let x = fat();
    x.shizzle();
}

One way to change this code would be to make the impl for &fat rather than for fat, and change x's expression to &fat(). Luckily this also seems to allow calling methods on @fat and ~fat types. Is this a reasonable way to migrate the code? Are their alternatives?

Thanks
Gareth

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

Reply via email to