This commit is contained in:
nub31
2025-07-09 20:04:06 +02:00
parent 60088757c3
commit e8f6c483bb
10 changed files with 93 additions and 86 deletions

View File

@@ -1,57 +1,16 @@
struct Name
template<T> struct Box
{
first: cstring
last: cstring
}
struct Human
{
name: Name
age: i64
}
trait Printable
{
func print()
}
impl Printable for Human
{
func print() {
c::puts(this.name.first)
}
value: T
}
func main(args: []cstring): i64
{
let human = alloc Human
let box = alloc Box<cstring>
{
name = alloc Name {
first = "john"
last = "doe"
}
age = 23
value = "bob"
}
human.print()
print_result(12, func (num) => num == 12)
let x: cstring = "test"
let addr = x&
c::puts(addr^)
c::puts(box.value)
return 0
}
func print_result(num: u64, delegate: func(u64): bool) {
if (delegate(num))
{
c::puts("true")
}
else
{
c::puts("false")
}
}