# Name of type and module clash

**URL:** <https://discourse.julialang.org/t/name-of-type-and-module-clash/6477>\
**Category:** General Usage\
**Tags:** type, module\
**Created:** [October 16, 2017, 3:48pm UTC](https://discourse.julialang.org/t/name-of-type-and-module-clash/6477 "2017-10-16T15:48:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![plapplop](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@plapplop](https://discourse.julialang.org/u/plapplop)\
**Post date:** [October 16, 2017, 3:48pm UTC](https://discourse.julialang.org/t/name-of-type-and-module-clash/6477/1 "2017-10-16T15:48:01Z")

</div>

Hello,

I need to write models according to a predefined template, and it contains a type called `Parameters`. I cannot really rename it as an entire computing platform (for many models) relies on this particular name. Now I’d like to use the `DifferentialEquations` package to solve ODEs for this model. Unfortunately, the module `Parameters` is used within this package (and despite that it is being used inside the module `DifferentialEquations`, its name is added to the names of the workspace…), and I cannot define my type `Parameters` subsequently. Following is the problematic code:

```julia
using DifferentialEquations
type Parameters
    p
end

```

I would have liked to remove the symbol `:Parameters` before defining my type `Parameters` from the workspace but as I understand this is not possible.

Is there anything I can do to solve this problem?

Many thanks,

---

<div class="post-metadata">

**Author:** ![ohsonice](https://avatars.discourse-cdn.com/v4/letter/o/d6d6ee/32.png) [@ohsonice](https://discourse.julialang.org/u/ohsonice)\
**Post date:** [October 16, 2017, 8:22pm UTC](https://discourse.julialang.org/t/name-of-type-and-module-clash/6477/2 "2017-10-16T20:22:55Z")

</div>

Can you encapsulate it into a module:

```julia
julia> module Foo
           struct Parameters # parameters
               p
           end
           function bar(t,x,pars) # rhs of ode 
               dx = similar(x)
               dx[1] = x[1] + pars.p
               dx
           end
       end
Foo

julia> using DifferentialEquations # still use differential equations functionality: 

julia> f = ParameterizedFunction(Foo.bar,Foo.Parameters(1))
(::ParameterizedFunction) (generic function with 2 methods)

julia> f(0,[1])
1-element Array{Int64,1}:
 2

```

---

<div class="post-metadata">

**Author:** ![plapplop](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@plapplop](https://discourse.julialang.org/u/plapplop)\
**Post date:** [October 16, 2017, 9:12pm UTC](https://discourse.julialang.org/t/name-of-type-and-module-clash/6477/3 "2017-10-16T21:12:01Z")

</div>

Thanks for your reply.

Unfortunately not, I really need my `Parameters` to be a type in the main scope. I was wondering if I could prevent Julia to load the name of the module `Parameters` in `names(Main)`.

I must mention that my `Parameters` has nothing to do with differential equations.

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [October 17, 2017, 1:22am UTC](https://discourse.julialang.org/t/name-of-type-and-module-clash/6477/4 "2017-10-17T01:22:16Z")

</div>

This issue is [fixed](https://github.com/JuliaLang/julia/pull/23579) in Julia 0.7. In the meantime, I don’t know any solution, but maybe macros can help? Eg. `@withparam begin ... end` could convert all instances of `Parameters` into `SomeModule.Parameters`.

---

<div class="post-metadata">

**Author:** ![plapplop](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@plapplop](https://discourse.julialang.org/u/plapplop)\
**Post date:** [October 17, 2017, 12:30pm UTC](https://discourse.julialang.org/t/name-of-type-and-module-clash/6477/5 "2017-10-17T12:30:35Z")

</div>

Thanks for the github ref, this is exactly the issue addressing my problem. I’ll probably wait until 0.7 is out to use this procedure, and I’ll rely on alternative ways to solve the ODEs for now.
