2011-07-27 07:19:39 -05:00
|
|
|
resource shrinky_pointer(i: @mutable int) { *i -= 1; }
|
2011-06-28 10:47:56 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn look_at(pt: &shrinky_pointer) -> int { ret **pt; }
|
2011-06-28 10:47:56 -05:00
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let my_total = @mutable 10;
|
|
|
|
{ let pt <- shrinky_pointer(my_total); assert (look_at(pt) == 10); }
|
2011-06-28 10:47:56 -05:00
|
|
|
assert (*my_total == 9);
|
2011-08-19 17:16:48 -05:00
|
|
|
}
|