# Revise.jl with Parameters.jl erroneous "invalid redefinition of constant" in 1.3.1

**URL:** <https://discourse.julialang.org/t/revise-jl-with-parameters-jl-erroneous-invalid-redefinition-of-constant-in-1-3-1/34475>\
**Category:** General Usage\
**Tags:** revise\
**Created:** [February 11, 2020, 4:45pm UTC](https://discourse.julialang.org/t/revise-jl-with-parameters-jl-erroneous-invalid-redefinition-of-constant-in-1-3-1/34475 "2020-02-11T16:45:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![torgo](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@torgo](https://discourse.julialang.org/u/torgo)\
**Post date:** [February 11, 2020, 4:45pm UTC](https://discourse.julialang.org/t/revise-jl-with-parameters-jl-erroneous-invalid-redefinition-of-constant-in-1-3-1/34475/1 "2020-02-11T16:45:44Z")

</div>

Here is a file called `ReviseBehavior.jl`

```julia
module ReviseBehavior

using Parameters

@with_kw struct MyStruct
    x::Array{<:Real, 1} = [.05]
end
export MyStruct

function foo()
    print("hello")
end
export foo

end

```

Here is the behavior that I don’t think is right? Or I am not understanding something about how Revise.jl and/or Parameters.jl are supposed to operate.

```julia
julia> using ReviseBehavior
[Info: Precompiling ReviseBehavior [top-level]

# here I go and change "hello" to "hello world" in ReviseBehavior.jl

julia> foo()
┌ Error: Failed to revise /home/at/Desktop/revise-behavior/ReviseBehavior.jl
│ exception =
│ invalid redefinition of constant MyStruct
│ Stacktrace:
│ [1] top-level scope at REPL[1]:0
└ @ Revise ~/.julia/packages/Revise/S7mrl/src/Revise.jl:590
┌ Warning: Due to a previously reported error, the running code does not match saved version for the following files:
│
│ /home/at/Desktop/revise-behavior/ReviseBehavior.jl
│
│ Use Revise.errors() to report errors again.
└ @ Revise ~/.julia/packages/Revise/S7mrl/src/Revise.jl:639
hello

```

I understand that Revise.jl can’t help me if I want to change something about a struct.  
But here I am changing something in the function `foo`, not the struct.

I am using the latest versions of Revise.jl and Parameters.jl.  
The problem occurs with Julia 1.3.1.  
However, it _does not_ occur with Julia 1.1.0.  
In 1.1.0, I get this expected behavior:

```julia
julia> using ReviseBehavior
[Info: Precompiling ReviseBehavior [top-level]

julia> foo()
hello world
julia>

```

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [February 11, 2020, 5:45pm UTC](https://discourse.julialang.org/t/revise-jl-with-parameters-jl-erroneous-invalid-redefinition-of-constant-in-1-3-1/34475/2 "2020-02-11T17:45:41Z")

</div>

Could you file that as an issue at [https://github.com/timholy/Revise.jl/issues](https://github.com/timholy/Revise.jl/issues)? I won’t get to it for a while and here I think it will just get lost.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [February 11, 2020, 5:52pm UTC](https://discourse.julialang.org/t/revise-jl-with-parameters-jl-erroneous-invalid-redefinition-of-constant-in-1-3-1/34475/3 "2020-02-11T17:52:11Z")

</div>

> [@torgo](#):
>
> Or I am not understanding something about how Revise.jl and/or Parameters.jl are supposed to operate.

How are you loading this code? As a package, or with `includet`? This is important for replicating your problem.

FWIW, both work fine for me on 1.3, 1.4, latest released Revise (v2.5.0).

As suggested, please open an issue.

---

<div class="post-metadata">

**Author:** ![torgo](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@torgo](https://discourse.julialang.org/u/torgo)\
**Post date:** [February 11, 2020, 6:07pm UTC](https://discourse.julialang.org/t/revise-jl-with-parameters-jl-erroneous-invalid-redefinition-of-constant-in-1-3-1/34475/4 "2020-02-11T18:07:56Z")

</div>

Ok, I will go open an issue on the repository.  
**Edit: Here it is [https://github.com/timholy/Revise.jl/issues/420](https://github.com/timholy/Revise.jl/issues/420)**

> [@Tamas\_Papp](#):
>
> How are you loading this code? As a package, or with `includet` ? This is important for replicating your problem.

I’m not sure I understand the question.  
I am loading Parameters.jl with

```julia
using Parameters

```

in the `ReviseBehavior.jl` file.  
I load Revise.jl in my `startup.jl` with

```julia
atreplinit() do repl
    try
        @eval using Pkg
        haskey(Pkg.installed(), "Revise") || @eval Pkg.add("Revise")
    catch
    end
    try
        @eval using Revise
        @async Revise.wait_steal_repl_backend()
    catch
    end
end

```

which is suggested in the Revise.jl documentation.

Here are my package versions

```julia
(v1.3) pkg> status Revise Parameters
    Status `~/.julia/environments/v1.3/Project.toml`
  [d96e819e] Parameters v0.12.0
  [295af30f] Revise v2.5.0

```
