Why Base.@kwdef is not exported?

Hi. I have a small question about Base.@kwdef.

I think this macro is very useful, already many packages are using Base.@kwdef.
https://github.com/search?q="Base.%40kwdef"&type=Code

I don’t know why @kwdef is not exported here?
https://github.com/JuliaLang/julia/blob/01b29ec71a8491d3e2f423546639d023765c556a/base/exports.jl#L940

Is it not recommended to use this macro?

1 Like

I am not sure about why, however I think it is safe to use it, if you check ?Base.@kwdef you will see it is well documented, what is often a clear signal it was intended to be used (specially considering the box saying it is available from Julia 1.1 on).

3 Likes

Perhaps +1 this issue? :wink:

https://github.com/JuliaLang/julia/issues/33192

3 Likes

This is not true. If it isn’t exported or in the manual it can dissapear whenever.

5 Likes

Good to know. I checked and did not found it in the last version of the manual, so it is not safe to use.

I find Base.@kwdef very useful and also think it should be exported.
Is there any specific reason why it could be removed in the future? Or is it just not documented because no one has done it yet ? :wink:

3 Likes