2011-09-12 04:27:30 -05:00
|
|
|
resource finish<T>(arg: {val: T, fin: fn(T)}) { arg.fin(arg.val); }
|
2011-06-30 07:46:17 -05:00
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let box = @mutable 10;
|
2011-09-12 04:27:30 -05:00
|
|
|
fn dec_box(i: @mutable int) { *i -= 1; }
|
2011-06-30 07:46:17 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
{ let i <- finish({val: box, fin: dec_box}); }
|
|
|
|
assert (*box == 9);
|
2011-08-12 08:37:25 -05:00
|
|
|
}
|