I am working with my own structs for the first time and am having some conceptual problems. Consider the code
mutable struct myTest
arr::Array{Float64, 1} # arr is an array
myTest(eqs::Array{Float64,1}) = new(eqs)
end
This works fine. But now, I change my mind and wish to change the 1D array to a 2D array. So I replace the 1st line of the structure, to get the new structure:
mutable struct myTest
arr::Array{Float64, 2} # arr is an array
myTest(eqs::Array{Float64,2}) = new(eqs)
end
I get the error message:
Invalid redefinition of constant myTest
So how does one create structs in experimental mode. I cannot make the correct decision on the first shot. I also created this structure within a module and got the same message. I would like to know how to change the type within the structure in order to “try” something out.
I understand the super optimization of Julia. What I do not understand is why there cannot be a “code construction mode” that is not optimized and which allow the coders more freedom. When the code is to be tested, the coder could flip some switch and return to the current way of doing things. This is very frustrating and there is a very steep learning curve. I have never worked with such a cool language and at the time with a language with these kinds of “apparent” limitations. I have not yet found any document or book that explains how to handle this situation.
Thank you all for your advice! I finally decided to put my structs inside a module, and use an include along with full path naming of the structures. This allows me to make the changes I want. So using Revise.jl would probably be advisable, but my first attempts failed, and I would like to make progress on the real code. So I am ok for now.