Type inference works, if I have a value to pass to the generic's construction, but that doesn't always make sense if I want to create an empty container, then fill it later.
struct Array<Contained> {
width: i64
height: i64
contents: raw[Contained]
fun create_array(width_: i64, height_: i64) -> Array {
mut array = new Array(width: width_, height: height_, contents: raw[])
let size = width_ * height_
unsafe { resize array.contents size }
return array
}
}
// works
let data = new Array(2,3,raw[false])
// does not work
// let data = Array<bool>::create_array(10, 12)
Type inference works, if I have a value to pass to the generic's construction, but that doesn't always make sense if I want to create an empty container, then fill it later.