2011-10-10 18:19:01 -07:00
|
|
|
// This is what the signature to spawn should look like with bare functions
|
|
|
|
|
2011-11-18 12:39:20 +01:00
|
|
|
fn spawn<send T>(val: T, f: fn(T)) {
|
2011-10-10 18:19:01 -07:00
|
|
|
f(val);
|
|
|
|
}
|
|
|
|
|
2011-10-20 20:34:04 -07:00
|
|
|
fn f(&&i: int) {
|
2011-10-10 18:19:01 -07:00
|
|
|
assert i == 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
spawn(100, f);
|
2011-10-20 20:34:04 -07:00
|
|
|
spawn(100, fn(&&i: int) {
|
2011-10-10 18:19:01 -07:00
|
|
|
assert i == 100;
|
|
|
|
});
|
|
|
|
}
|