2012-06-01 23:54:38 -05:00
|
|
|
// Note: impl on a slice
|
2012-07-11 12:28:30 -05:00
|
|
|
impl foo for &int {
|
2012-06-01 23:54:38 -05:00
|
|
|
fn get() -> int {
|
|
|
|
ret *self;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
/*
|
|
|
|
let x = @mut 6;
|
|
|
|
let y = x.get();
|
|
|
|
assert y == 6;
|
|
|
|
*/
|
|
|
|
|
|
|
|
let x = @6;
|
|
|
|
let y = x.get();
|
|
|
|
#debug["y=%d", y];
|
|
|
|
assert y == 6;
|
|
|
|
|
|
|
|
let x = ~mut 6;
|
|
|
|
let y = x.get();
|
|
|
|
#debug["y=%d", y];
|
|
|
|
assert y == 6;
|
|
|
|
|
|
|
|
let x = ~6;
|
|
|
|
let y = x.get();
|
|
|
|
#debug["y=%d", y];
|
|
|
|
assert y == 6;
|
|
|
|
|
|
|
|
let x = &6;
|
|
|
|
let y = x.get();
|
|
|
|
#debug["y=%d", y];
|
|
|
|
assert y == 6;
|
|
|
|
}
|