Skip to content

Commit

Permalink
document mutable struct const fields (#55203)
Browse files Browse the repository at this point in the history
Introduced in #43305
  • Loading branch information
IanButterworth authored Jul 23, 2024
1 parent b75c133 commit 6b08e80
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1451,8 +1451,20 @@ kw"struct"
mutable struct
`mutable struct` is similar to [`struct`](@ref), but additionally allows the
fields of the type to be set after construction. See the manual section on
[Composite Types](@ref) for more information.
fields of the type to be set after construction.
Individual fields of a mutable struct can be marked as `const` to make them immutable:
```julia
mutable struct Baz
a::Int
const b::Float64
end
```
!!! compat "Julia 1.8"
The `const` keyword for fields of mutable structs requires at least Julia 1.8.
See the manual section on [Composite Types](@ref) for more information.
"""
kw"mutable struct"

Expand Down

5 comments on commit 6b08e80

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@vtjnash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@vtjnash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All BigFloat/BigInt/String operations allocate 10% more, because of the PR to correctly account for their allocations

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Please sign in to comment.