36 lines
936 B
Text
36 lines
936 B
Text
(* all arguments are unique/linear *)
|
|
|
|
typarts.refmap : Λ $This: Type → Λ $self: &This → (Λ $t: Type → Λ $v: &t → t);
|
|
typarts.foreach : Λ $This: Type → Λ $self: This → (Λ $t: Type → Λ $v: t → ());
|
|
|
|
Drop registry: Λ $This : Type → ^{ drop = Λ This → (); };
|
|
|
|
Drop_default : Drop = λ $This : Type → .{
|
|
drop = λ $self: This → {
|
|
std.typarts.foreach This self (λ $t: Type → λ $v: t → (Drop t).drop v);
|
|
()
|
|
};
|
|
};
|
|
|
|
Drop usize = @{lang = Drop_native};
|
|
Drop isize = @{lang = Drop_native};
|
|
|
|
Clone registry: Λ $This : Type → ^{
|
|
inherit Drop;
|
|
clone = Λ &This → This;
|
|
};
|
|
|
|
Clone_default : Clone = λ $This : Type → .{
|
|
clone = λ $self: &This → {
|
|
std.typarts.refmap This self (λ $t: Type → λ $v: &t → (Clone t).clone v);
|
|
()
|
|
};
|
|
};
|
|
|
|
Clone usize = @{lang = Clone_native};
|
|
Clone isize = @{lang = Clone_native};
|
|
|
|
main = λ $io {
|
|
io = std.println io "Hello World!";
|
|
};
|