I’ve following dir structure:
-> Calc (root dir)
-> src
-> Calc.jl
-> Controls.jl
-> Models.jl
Below are the content of the files:
Calc.jl:
module Calc
include("Models.jl")
include("Controls.jl")
export Models,Controls
end # module
Models.jl
module Models
struct Position{P <: Real}
x::P
y::P
end
struct Size{P <: Int}
width::P
height::P
end
struct Widget{N <: String,P <: Position,S <: Size}
name::N
postion::P
size::S
end
end
Controls.jl
module Controls
move_up!(widget::Models.Widget, velocity) = widget.position.x + velocity
end
I get errors when I try to add Widget as a parameter to my function defined in Controls.jl file.
How can I properly define my parameter ?
Please note the following constraints:
- Should use Modules
- Should not merge Controls and Models content in one single file
Please help thanks
7 posts - 2 participants