Subtyping Polymorphic arguments; using procedure parameters

This commit is contained in:
Ginger Bill
2016-08-30 23:32:04 +01:00
parent a06f70d5d9
commit cda0234d48
8 changed files with 438 additions and 319 deletions
+17 -15
View File
@@ -3,26 +3,28 @@
#load "game.odin"
main :: proc() {
Thing :: type struct {
using x: struct { a, b: int }
Vec3 :: type struct { x, y, z: f32 }
Entity :: type struct {
using pos: Vec3
name: string
}
{
using t := new(Thing)
defer delete(t)
a = 321
print_int(a); nl()
Frog :: type struct {
using entity: Entity
jump_height: f32
}
// {
// using t := new(Thing)
// defer delete(t)
// a = 1337
// print_int(a); nl()
// }
f := Frog{}
f.name = "ribbit"
print_name :: proc(using e: Entity) {
print_string(name); nl()
}
print_name(f.entity)
print_name(f)
// run_game()
}