# \#parametersjl

**URL:** https://discourse.julialang.org/tag/parametersjl/1060.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Yet another "how to pass multiple parameters to a function" post](https://discourse.julialang.org/t/yet-another-how-to-pass-multiple-parameters-to-a-function-post/127095)

<div class="topic-metadata">

**Author:** [@Boris](https://discourse.julialang.org/u/Boris)\
**Replies:** 7\
**Last updated:** [March 21, 2025, 5:33pm UTC](https://discourse.julialang.org/t/yet-another-how-to-pass-multiple-parameters-to-a-function-post/127095 "2025-03-21T17:33:05Z")

</div>

Apologies for the n-th post on this topic (#1, #2, #3, etc. etc).I simply don’t get it and feel overwhelmed by all choices of how to pass parameters to a function (positional arguments, optional keyword arguments, named …

---

## [Wrapping kw-based Parameters.jl constructor, for deprecation](https://discourse.julialang.org/t/wrapping-kw-based-parameters-jl-constructor-for-deprecation/122909)

<div class="topic-metadata">

**Author:** [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Replies:** 4\
**Last updated:** [December 3, 2024, 6:21pm UTC](https://discourse.julialang.org/t/wrapping-kw-based-parameters-jl-constructor-for-deprecation/122909 "2024-12-03T18:21:14Z")

</div>

I have a config object like this: using Parameters @with\_kw mutable struct Config "Param 1" param1::Float64 # ... several other items ... "Whether to iterate randomly." use\_random::Bool = false en…

---

## [Creating Parameters.jl struct samples using variable keywords](https://discourse.julialang.org/t/creating-parameters-jl-struct-samples-using-variable-keywords/121639)

<div class="topic-metadata">

**Author:** [@JPool](https://discourse.julialang.org/u/JPool)\
**Replies:** 4\
**Last updated:** [October 23, 2024, 5:06pm UTC](https://discourse.julialang.org/t/creating-parameters-jl-struct-samples-using-variable-keywords/121639 "2024-10-23T17:06:13Z")

</div>

Hi, I’m trying to make a function that takes in a default struct which holds parameters for my model. I want to be able to make a sample list where some properties are kept constant, and some are sampled using a sampling…

---

## [Update on Base.@kwdef versus Parameters.jl](https://discourse.julialang.org/t/update-on-base-kwdef-versus-parameters-jl/95042)

<div class="topic-metadata">

**Author:** [@mocalvao](https://discourse.julialang.org/u/mocalvao)\
**Replies:** 10\
**Last updated:** [May 16, 2024, 2:41pm UTC](https://discourse.julialang.org/t/update-on-base-kwdef-versus-parameters-jl/95042 "2024-05-16T14:41:23Z")

</div>

Hi, I have checked the Stackoverflow topic Difference between @with\_kw and Base.@kwdef in Julia?, whose last update is from Oct, 18, 2021, and would like to know whether there should be any drawbacks due to my current p…

---

## [Make @with\_kw structure display with detail all its parameters](https://discourse.julialang.org/t/make-with-kw-structure-display-with-detail-all-its-parameters/109731)

<div class="topic-metadata">

**Author:** [@K5Julien](https://discourse.julialang.org/u/K5Julien)\
**Replies:** 4\
**Last updated:** [February 5, 2024, 10:09pm UTC](https://discourse.julialang.org/t/make-with-kw-structure-display-with-detail-all-its-parameters/109731 "2024-02-05T22:09:34Z")

</div>

Suppose that I use Parameters.jl and the following @with\_kw structure: using Parameters using Dates @with\_kw struct Params @deftype Int #PARAMETERS foo = 5 bar::Dict{String,Int} = Dict("a"=\>0,"b"=\>1) ti…

---

## [Passing struct as argument to optimizer](https://discourse.julialang.org/t/passing-struct-as-argument-to-optimizer/109209)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 2\
**Last updated:** [January 24, 2024, 9:38pm UTC](https://discourse.julialang.org/t/passing-struct-as-argument-to-optimizer/109209 "2024-01-24T21:38:51Z")

</div>

Is it possible to pass a struct of parameters as an argument to an optimizer? The example below estimates an OLS model in which the intercept and slope are passed a vector p. function ssr(y,x,p) return sum((y .- (p\[…

---

## [Struct with block of missing fields](https://discourse.julialang.org/t/struct-with-block-of-missing-fields/100869)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 9\
**Last updated:** [June 27, 2023, 10:17pm UTC](https://discourse.julialang.org/t/struct-with-block-of-missing-fields/100869 "2023-06-27T22:17:53Z")

</div>

I’d like to have a struct like this. @with\_kw struct my\_struct x; y; z a b=fb(a) c=fc(b) d=fd(c) e=fe(d) f=ff(e) g=fg(f) h=fh(g) i=fi(h) end That can be created in two ways …

---

## [Using parameters inside a function](https://discourse.julialang.org/t/using-parameters-inside-a-function/92004)

<div class="topic-metadata">

**Author:** [@dgagnon](https://discourse.julialang.org/u/dgagnon)\
**Replies:** 4\
**Last updated:** [December 22, 2022, 2:51pm UTC](https://discourse.julialang.org/t/using-parameters-inside-a-function/92004 "2022-12-22T14:51:58Z")

</div>

Hello I want to use a function using parameters.jl. Inside REPL I simply type: julia\> called\_function(param1=4, param2=0) The function “called\_function” has other parameters but those have default values which are goo…

---

## [Create Parameters object from a dictionary](https://discourse.julialang.org/t/create-parameters-object-from-a-dictionary/85912)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 5\
**Last updated:** [August 18, 2022, 12:55pm UTC](https://discourse.julialang.org/t/create-parameters-object-from-a-dictionary/85912 "2022-08-18T12:55:22Z")

</div>

I have two dictionaries: d1 = Dict(:name =\> "Fido") d2 = Dict(:name =\> "Spot", :breed =\> :poodle) Which I’d like to use to create two using Parameters @with\_kw mutable struct Dog name::String breed::Symbol = :…

---

## [Using a \`new\` constructor with Parameters.jl \`@with\_kw\`](https://discourse.julialang.org/t/using-a-new-constructor-with-parameters-jl-with-kw/84588)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 3\
**Last updated:** [July 21, 2022, 1:41pm UTC](https://discourse.julialang.org/t/using-a-new-constructor-with-parameters-jl-with-kw/84588 "2022-07-21T13:41:10Z")

</div>

I’d like to do something like this. using Parameters struct Cat breed colour age weight name end @with\_kw struct Pet name kind age function Pet(cat::Cat) new(name= cat.name,…

---

## [Constructor with Varargs](https://discourse.julialang.org/t/constructor-with-varargs/84568)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [July 21, 2022, 12:09pm UTC](https://discourse.julialang.org/t/constructor-with-varargs/84568 "2022-07-21T12:09:15Z")

</div>

This works using Pipe, Parameters @with\_kw struct X A B end x = (A=1, B=2 ) X( x... ) but this fails x = (A=1, B=2, C=3 ) X( x... ) unless you manually filter x to only contain the fields of X. or manually…

---

## [Does Parameters.jl support a Varargs ... constuctor](https://discourse.julialang.org/t/does-parameters-jl-support-a-varargs-constuctor/83100)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [June 21, 2022, 1:12am UTC](https://discourse.julialang.org/t/does-parameters-jl-support-a-varargs-constuctor/83100 "2022-06-21T01:12:07Z")

</div>

a,b,c = 1:3 @with\_kw mutable struct T a b end T(;a,b) works T(;a,b,c) fails Can the kwargs constructor have a Varargs component X... ? It allowed me to create one T(;a,b, X... ) = T(;a,b) B…
