@kwdef kwargs

Could there be a flag added to @kwdef (say @kwargs) that adds a kwargs... to the constructor inputs so that

@kwdef @kwargs struct X
    a
    b
end

X(; a=1, b=2, c=3 )

Would work the same as

X(; a=1, b=2 )

i.e. additional arguments in the constructor call are ignored.

Usually I use Parameters.jl.

I think it offers all what you need?

1 Like

I requested it of Parameters.jl

At the time I think @kwdef wasn’t available to users but now is.