...
This commit is contained in:
@@ -1,41 +1,47 @@
|
||||
// struct name
|
||||
// {
|
||||
// first: cstring
|
||||
// last: cstring
|
||||
// }
|
||||
struct name
|
||||
{
|
||||
first: cstring
|
||||
last: cstring
|
||||
}
|
||||
|
||||
// struct human
|
||||
// {
|
||||
// name: name
|
||||
// age: i64
|
||||
// }
|
||||
struct human
|
||||
{
|
||||
name: name
|
||||
age: i64
|
||||
}
|
||||
|
||||
// trait printable
|
||||
// {
|
||||
// func print()
|
||||
// }
|
||||
trait printable
|
||||
{
|
||||
func print()
|
||||
}
|
||||
|
||||
// impl printable for human
|
||||
// {
|
||||
// func print() {
|
||||
// c::puts(this.name.first)
|
||||
// }
|
||||
// }
|
||||
impl printable for human
|
||||
{
|
||||
func print() {
|
||||
c::puts(this.name.first)
|
||||
}
|
||||
}
|
||||
|
||||
func main(args: []cstring): i64
|
||||
{
|
||||
// let human = alloc human
|
||||
// {
|
||||
// name = alloc name {
|
||||
// first = "john"
|
||||
// last = "doe"
|
||||
// }
|
||||
// age = 23
|
||||
// }
|
||||
let human = alloc human
|
||||
{
|
||||
name = alloc name {
|
||||
first = "john"
|
||||
last = "doe"
|
||||
}
|
||||
age = 23
|
||||
}
|
||||
|
||||
// human.print()
|
||||
human.print()
|
||||
print_result(12, func(num) { return num == 12 })
|
||||
|
||||
let x: cstring = "test"
|
||||
|
||||
let addr = x&
|
||||
|
||||
c::puts(addr^)
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user