open System open Option type Safearray<'T> = struct val A:Option<'T> [], new(n) = {A = Array.create n None;} // create array of None instead of null end;; type KVpair<'A,'B> = // key-value pair struct val mutable key:'A val mutable value:'B new(x,y) = {key=x; value=y;} // can have constructor of struct override this.ToString() = sprintf "%A:%A" this.key this.value end;;