Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@kwdef: export and add to public api #46273

Merged
merged 5 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Library changes
* `@time` now separates out % time spent recompiling invalidated methods ([#45015]).
* `eachslice` now works over multiple dimensions; `eachslice`, `eachrow` and `eachcol` return
a `Slices` object, which allows dispatching to provide more efficient methods ([#32310]).
* `@kwdef` is now exported and added to the public API ([#46273])

Standard library changes
------------------------
Expand Down
1 change: 1 addition & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ export
# syntax
esc,
gensym,
@kwdef,
macroexpand,
@macroexpand1,
@macroexpand,
Expand Down
5 changes: 4 additions & 1 deletion base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,12 @@ order to function correctly with the keyword outer constructor.
`Base.@kwdef` for parametric structs, and structs with supertypes
requires at least Julia 1.1.

!!! compat "Julia 1.9"
This macro is exported as of Julia 1.9.

# Examples
```jldoctest
julia> Base.@kwdef struct Foo
julia> @kwdef struct Foo
a::Int = 1 # specified default
b::String # required keyword
end
Expand Down
1 change: 1 addition & 0 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ outer
const
struct
mutable struct
@kwdef
abstract type
primitive type
where
Expand Down