Open singularitti opened 4 years ago
In principle this is covered by the auto-generated doc-strings. Although they don't work too well:
julia> "Some Doc"
@with_kw struct A
a = 1
b
c = 2.0
d
e = "test"
end
A
help?> A
search: A Any any all abs ARGS ans axes atan asin asec any! all! acsc acot acos abs2 Array atanh atand asinh asind asech asecd ascii angle acsch acscd
Some Doc
help?> A.a
Default: 1
help?> A.b
A has fields a, b, c, d, and e.
So, this should be fixed . But I'm against adding those query methods.
This is not for documenting issues. It is for programming issues. I want to filter all the fields that have default values and do things to them. It is not possible and ugly to list them one by one for a type with many (>20) fields.
I see. This seems pretty niche and is not something I ever see myself using, so I'm not interested in having to support this. However, I think this could be implemented with a post-processing function, for which support is envisaged, at some point. Something along what's mentioned in #52.
In addition to this issue topic, it is sometimes useful to have access to the default values for some fields.
This capability can allow for more rich integration when automatically populating structures (e.g. custom ArgParse.jl integrations).
If we have a type that is not entirely fed with default values, is there a method that can tell users which fields have default values and which fields do not? For example,