2012-01-11 11:58:05 -06:00
|
|
|
resource finish<T>(arg: {val: T, fin: native fn(T)}) {
|
|
|
|
arg.fin(arg.val);
|
|
|
|
}
|
2011-06-30 07:46:17 -05:00
|
|
|
|
|
|
|
fn main() {
|
2012-03-26 20:35:18 -05:00
|
|
|
let box = @mut 10;
|
|
|
|
fn dec_box(&&i: @mut 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
|
|
|
}
|