struct Foo { static Func2(u: U) : U { return u; } static Func(t: T): T { foo: T = t; return Foo.Func2(foo); } } struct MemoryBlock { start: MemoryAddress; capacity: uint; AddressOf(index: uint): MemoryAddress { return start + (index * @sizeof()); } Get(index: uint): T { return @dereference(AddressOf(index)); } Set(index: uint, value: T): void { @memcpy(AddressOf(index), @addr(value), @sizeof()); } Free(): void { @free(start); } } struct Array { memoryBlock: MemoryBlock; static Init(capacity: uint): Array { return Array { memoryBlock: MemoryBlock { capacity: capacity, start: @malloc(capacity * @sizeof()) } }; } Get(index: uint): T { return memoryBlock.Get(index); } } interface Iterable { HasNext(): bool; Next(): T; } struct Program { static Main(): int { array: Array = Array.Init(4); x: int = 4; y: int = Foo.Func(x); block: MemoryBlock = MemoryBlock { capacity: y, start: @malloc(y * @sizeof()) }; block.Set(0, 5); block.Set(1, 3); block.Set(2, 9); block.Set(3, 100); Console.PrintLine("%p", block.start); Console.PrintLine("%i", block.Get(0)); Console.PrintLine("%i", block.Get(1)); Console.PrintLine("%i", block.Get(2)); Console.PrintLine("%i", block.Get(3)); block.Free(); return 0; } }