This commit is contained in:
nub31
2025-07-04 17:48:56 +02:00
parent 9a21ec5d8d
commit cea72bf846
11 changed files with 346 additions and 78 deletions

View File

@@ -1,6 +1,7 @@
namespace main
struct Name {
struct Name
{
first: cstring
last: cstring
}
@@ -11,6 +12,18 @@ struct Human
age: i64
}
interface Printable
{
func print()
}
impl Human : Printable
{
func print() {
c::puts(this.name)
}
}
export func main(args: []cstring): i64
{
let x = alloc Human
@@ -22,10 +35,7 @@ export func main(args: []cstring): i64
age = 23
}
print_name(x&)
x.print()
return 0
}
func print_name(human: ^Human) {
c::puts(human^.name.last)
}