# Handling solver parameters elegantly in Julia

**URL:** <https://discourse.julialang.org/t/handling-solver-parameters-elegantly-in-julia/5269>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 8, 2017, 1:24am UTC](https://discourse.julialang.org/t/handling-solver-parameters-elegantly-in-julia/5269 "2017-08-08T01:24:09Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [August 21, 2017, 5:13am UTC](https://discourse.julialang.org/t/handling-solver-parameters-elegantly-in-julia/5269/11 "2017-08-21T05:13:58Z")

</div>

@tshort, I am back to this issue after a while. I am giving NamedTuple a try, but couldn’t make the outer constructor below work:

```julia
using Parameters: @with_kw

@with_kw struct Param
 mean = 0.
 variance = 1.
end

struct Solver
 params::Dict{Symbol,Param}

 # inner ctor to be called from outside
 Solver(params::Dict{Symbol,Param}) = new(params)
end

# outer ctor with named tuples
function Solver(params...)
 dict = Dict{Symbol,Param}()
 for (varname, varparams) in params
   push!(dict, varname => Param(varparams...)) # doesn't work
 end

 Kriging(dict)
end

```

Could you please give a hand? The goal is to have the Solver working with named tuples as you described:

```julia
Solver(:var1 => @NT(mean=1), :var2 => @NT(variance=2.))

```

---

_[View the full topic](https://discourse.julialang.org/t/handling-solver-parameters-elegantly-in-julia/5269)._
