2011-06-28 10:53:00 -05:00
|
|
|
resource shrinky_pointer(@mutable int i) {
|
2011-06-28 10:47:56 -05:00
|
|
|
*i -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn look_at(&shrinky_pointer pt) -> int {
|
|
|
|
ret **pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
auto my_total = @mutable 10;
|
|
|
|
{
|
|
|
|
auto pt <- shrinky_pointer(my_total);
|
|
|
|
assert (look_at(pt) == 10);
|
|
|
|
}
|
|
|
|
assert (*my_total == 9);
|
|
|
|
}
|