Suppose I assigned the type Person to Julia:
type Person name::String male::Bool age::Float64 children::Int end function describe(p::Person) println("Name: ", p.name, " Male: ", p.male) println("Age: ", p.age, " Children: ", p.children) end ted = Person("Ted",1,55,0) describe(ted)
which will be displayed using the function:
Name: Ted Male: true Age: 55.0 Children: 0
Then I change the functions for type Person , where I added a new category to type eyes
type Person name::String male::Bool age::Float64 children::Int eyes::String end ted = Person("Ted",1,55,0,brown)
If I run the function, now I get an error
Error evaluating REPL: invalid redefinition of constant Person in include_string at loading.jl:97
What is the best way to get around this when developing new code? besides creating a module as suggested in julia Frequently Asked Questions
types oop julia-lang
ccsv
source share