Ideally we’d be able to do something like this at some point:
@fieldwise_init
struct MyComplex:
var re: Int
var im: Int = 0
@fieldwise_init
struct MyComplexList:
comptime _L = List[MyComplex]
var elems: Self._L = DefaultFactory(Self._L.__init__)
comptime DefaultFactory[...] = ... # some mlir black magic
And I think this would also allow us to finally have default values for functions where the values can’t be folded at compile time, which has already happened to me a couple of times and is annoying because I had to redesign the API.
cc: @denis