Also, you can put a guard around it:

if !isdefined(:MyType)
   include("myfile.jl")
end

On Wed, 2016-06-29 at 21:33, Matthieu Gomez <[email protected]> wrote:
> I have a file myfile.jl with the following lines:
> type MyType{T}
>    x::T
> end
> 1 + 1
>
> Julia returns an error when I repeatedly include this file
> include("myfile.jl")
> #> 2
> include("myfile.jl")
> #> ERROR: LoadError: invalid redefinition of constant MyType
>
> The error message only appears if MyType is a parametric type. The error
> appears even though MyType is not redefined.
> Where does this error come from? Is there a way to avoid it? This forces me
> to restart Julia everytime I update myfile

Reply via email to