I am having difficulties defining a module and testing it.
I have the following architecture:
file: my_struct.jl
mutable struct my_struct
x
y
z
end
function my_struct(x, y)
z = Vector(undef, x)
return my_struct(x,y,z)
end
file my_module.jl
module my_module
export my_struct
include("my_struct.jl")
end
file test.jl
include("my_module.jl")
using .my_module
b = my_struct(x,y)
When running test.jl I get an error saying “No method matching my_struct(::type, ::type). Closest candidates are my_struct(::Any, ::Any, ::Any)”.
Can anybody explain why I can not use the self-built constructor in test.jl and how to fix this?