1    type Ptr<T>
2        fun get (i : u32) : T
3        fun get (i : i32) : T
4    
5        def (+)<U> (rhs : U) : Self where U : Integer
6        def (-)<U> (rhs : U) : Self where U : Integer
7        def (-) rhs : i32
8    
9        fun get_ptr (i : u32) = self + i
10       fun get_ptr (i : i32) = self + i
11   
12   type MutPtr<T>
13       fun set (i : u32) (value : T)
14       fun set (i : i32) (value : T)
15       fun get_mut_ptr (i : u32) = self + i
16       fun get_mut_ptr (i : i32) = self + i
17   
18   let kd_alloc (size : u32) : MutPtr
19   
20   def alloc<T> (count : u32) =
21       let size = sizeof T * count
22       let ptr = kd_alloc size
23       ptr as MutPtr<T>
24