Stream: helpdesk (published)

Topic: keyward argument macro hidden in base


view this post on Zulip Expanding Man (Feb 04 2021 at 23:23):

There is some package that exports a @with_kw macro that gives you struct constructors with keywords and defaults... I seem to recall that this actually exists in Base somewhere but is not exported... anybody know what this is? I can't seem to find either one

view this post on Zulip Alex Ames (Feb 04 2021 at 23:30):

Base.@kwdef

view this post on Zulip Expanding Man (Feb 04 2021 at 23:32):

Nice, thanks. Do we know why this is not exported?

view this post on Zulip Fredrik Ekre (Feb 04 2021 at 23:37):

The package is Parameters.jl. As for the one in base, I think it is partly because Base could do something better (e.g. some syntax without a macro), partly because it is no trivial to decide what default constructors etc should be defined and partly because it is something that works fine from an external package.


Last updated: Nov 22 2024 at 04:41 UTC