Parameters.jl strange values in struct coming from dict

The inner constructor overrides the default constructor, such as the one created by @with_kw, I believe.

Using an outer constructor instead should work:

@with_kw mutable struct Struct1
    name::String
    dval ::Int = D1[name]
end
 Struct1(name) = Struct1(;name)

Note that I have essentially defined an additional constructor, which calls the original one

1 Like