2011-12-29 22:07:55 -06:00
|
|
|
use std;
|
|
|
|
|
|
|
|
fn asSendfn( f : sendfn()->uint ) -> uint {
|
|
|
|
ret f();
|
|
|
|
}
|
|
|
|
|
2012-01-09 18:12:37 -06:00
|
|
|
fn asLambda( f : fn@()->uint ) -> uint {
|
2011-12-29 22:07:55 -06:00
|
|
|
ret f();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn asBlock( f : block()->uint ) -> uint {
|
|
|
|
ret f();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = asSendfn({|| 22u});
|
|
|
|
assert(x == 22u);
|
|
|
|
let x = asLambda({|| 22u});
|
|
|
|
assert(x == 22u);
|
|
|
|
let x = asBlock({|| 22u});
|
|
|
|
assert(x == 22u);
|
|
|
|
}
|