22 lines
481 B
Text
22 lines
481 B
Text
(* all arguments are unique/linear *)
|
|
|
|
#![lang_mark(std.Drop)]
|
|
iface Drop ^{
|
|
drop = π (_: ^This) -> ();
|
|
} template .{
|
|
drop = λ (x: ^This) -> {
|
|
std.typarts.foreach ^This.parts (λ (t: *) -> λ (v: t) -> (Drop t).drop v);
|
|
()
|
|
};
|
|
};
|
|
|
|
#![lang_mark(std.Clone)]
|
|
iface Clone ^{
|
|
inherit Drop;
|
|
clone = π (self: &^This) -> ^This;
|
|
} template .{
|
|
clone = λ (self: &^This) -> {
|
|
std.typarts.map ^This.parts (λ (t: *) -> λ (x: t) -> (Clone t).clone v);
|
|
()
|
|
};
|
|
};
|