2023-10-14 14:34:57 +00:00
|
|
|
(* all arguments are unique/linear *)
|
|
|
|
|
2023-10-14 23:10:05 +00:00
|
|
|
Drop = #[lang = Drop] iface ^{
|
|
|
|
drop = Λ (_: ^This) → ();
|
|
|
|
} default .{
|
|
|
|
drop = λ (x: ^This) → {
|
|
|
|
std.typarts.foreach ^This.parts (λ (t: Type) → λ (v: t) → (Drop t).drop v);
|
2023-10-14 14:34:57 +00:00
|
|
|
()
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-10-14 23:10:05 +00:00
|
|
|
Clone = #[lang = Clone] iface ^{
|
2023-10-14 14:34:57 +00:00
|
|
|
inherit Drop;
|
2023-10-14 23:10:05 +00:00
|
|
|
clone = Λ (self: &^This) → ^This;
|
|
|
|
} default .{
|
|
|
|
clone = λ (self: &^This) → {
|
|
|
|
std.typarts.map ^This.parts (λ (t: Type) → λ (x: t) → (Clone t).clone v);
|
2023-10-14 14:34:57 +00:00
|
|
|
()
|
|
|
|
};
|
|
|
|
};
|
2023-10-14 23:10:05 +00:00
|
|
|
|
|
|
|
main = λ {
|
|
|
|
std.println "Hello World!";
|
|
|
|
};
|