I made a type in my constructor (Tset instead of Test) and noticed that Julia does not complain if there is another function in the struct definition that has a different name than the struct itself. What happens to this line when I run my code and why is there no error?
struct Test
a::Array{Float64, 3}
Test(i) = new(rand(i, i, i))
Tset(i, c) = new(rand(c*i, c*i, c*i))
end
test = Test(2)
# test = Test(2, 3)
It doesn’t seem entirely unreasonable if you need a couple different inner constructors and they can share some code. But I’ve never seen it used and I only rarely use inner constructors at all myself.