Simple example. Let's say I have the type
type Mesh
elements::Vector{Element}
node::Vector{Node}
end
and I want to add functions to add elements or nodes. I could either do
this by overloading push! like this:
push!(mesh::Mesh, elem::Element) = push!(mesh.elements, elem)
or add a new method
addelement(mesh::Mesh, elem::Element) = push!(mesh.elements, elem)
I know code where operators are heavily overloaded can be difficult to read
however, this case seems quite simple.
Anyone have any advice for which way to prefer? What is more Julian?
Best regards,
Kristoffer Carlsson