# Catching deprecated keyword arguments (with Parameters.jl)

**URL:** <https://discourse.julialang.org/t/catching-deprecated-keyword-arguments-with-parameters-jl/81235>\
**Category:** General Usage\
**Created:** [May 18, 2022, 7:00am UTC](https://discourse.julialang.org/t/catching-deprecated-keyword-arguments-with-parameters-jl/81235 "2022-05-18T07:00:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sstroemer](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Post date:** [May 18, 2022, 7:00am UTC](https://discourse.julialang.org/t/catching-deprecated-keyword-arguments-with-parameters-jl/81235/1 "2022-05-18T07:00:08Z")

</div>

Consider a `struct` like

```julia
@with_kw struct MyStruct
    a::Int = 3
    b::Int = 5
end

```

`b` is no longer needed, so I am looking to deprecate it in the future, changing to

```julia
@with_kw struct MyStruct
    a::Int = 3
end

```

Now, if someone uses `MyStruct(b=1)`, this obviously results in `MethodError: no method matching MyStruct(; b=3)`. There is a somewhat similar [question here](https://discourse.julialang.org/t/deprecate-keyword-argument/33740). I know I could just leave `b` in the `struct` for some time (preventing the error), but I am looking for a “nice” way to trigger a warning. Is there anything in `Parameters.jl` that I could use?

(I thought about using a custom constructor, but since I’m not using positional arguments, that seems impossible since `Parameters.jl` states: _no zero-positional arguments constructor is defined_)
