2011-06-15 11:19:50 -07:00
|
|
|
|
|
|
|
|
2010-06-23 21:03:09 -07:00
|
|
|
type tupbox[T] = tup(@T);
|
2011-06-15 11:19:50 -07:00
|
|
|
|
2010-06-23 21:03:09 -07:00
|
|
|
type recbox[T] = rec(@T x);
|
|
|
|
|
2010-10-28 15:02:00 -07:00
|
|
|
fn tuplift[T](&T t) -> tupbox[T] { ret tup(@t); }
|
2011-06-15 11:19:50 -07:00
|
|
|
|
2010-10-28 15:02:00 -07:00
|
|
|
fn reclift[T](&T t) -> recbox[T] { ret rec(x=@t); }
|
2010-06-23 21:03:09 -07:00
|
|
|
|
|
|
|
fn main() {
|
2011-06-15 11:19:50 -07:00
|
|
|
let int foo = 17;
|
|
|
|
let tupbox[int] tbfoo = tuplift[int](foo);
|
|
|
|
let recbox[int] rbfoo = reclift[int](foo);
|
|
|
|
assert (tbfoo._0 == foo);
|
|
|
|
assert (rbfoo.x == foo);
|
|
|
|
}
|