I have been recently using julia and I want to know what the “proper” way of overloading operators is.
Right now whwat I’m doing is defining a module and, inside that module i have basically the following:
module mymodule import Base : +,-,*,/ ..... ..... export +,-,*,/ struct MyStruct end function +(x::MyStruct, y::MyStruct) ... end ..... end
And then for each operator I want to define in addition to implementing the method I have to remember to modify what I import and export from my module.
Is there a cleaner way to do this?