Consider a struct
like
@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
@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. 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)