2011-12-29 20:07:55 -08:00
|
|
|
use std;
|
|
|
|
|
2012-01-11 09:58:05 -08:00
|
|
|
fn asSendfn( f : fn~()->uint ) -> uint {
|
2012-08-01 17:30:05 -07:00
|
|
|
return f();
|
2011-12-29 20:07:55 -08:00
|
|
|
}
|
|
|
|
|
2012-01-09 16:12:37 -08:00
|
|
|
fn asLambda( f : fn@()->uint ) -> uint {
|
2012-08-01 17:30:05 -07:00
|
|
|
return f();
|
2011-12-29 20:07:55 -08:00
|
|
|
}
|
|
|
|
|
2012-01-23 14:59:00 -08:00
|
|
|
fn asBlock( f : fn&()->uint ) -> uint {
|
2012-08-01 17:30:05 -07:00
|
|
|
return f();
|
2012-01-23 14:59:00 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn asAny( f : fn()->uint ) -> uint {
|
2012-08-01 17:30:05 -07:00
|
|
|
return f();
|
2011-12-29 20:07:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-06-30 16:19:07 -07:00
|
|
|
let x = asSendfn(|| 22u);
|
2011-12-29 20:07:55 -08:00
|
|
|
assert(x == 22u);
|
2012-06-30 16:19:07 -07:00
|
|
|
let x = asLambda(|| 22u);
|
2011-12-29 20:07:55 -08:00
|
|
|
assert(x == 22u);
|
2012-06-30 16:19:07 -07:00
|
|
|
let x = asBlock(|| 22u);
|
2011-12-29 20:07:55 -08:00
|
|
|
assert(x == 22u);
|
|
|
|
}
|