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

Mention const field of mutable struct #43531

Merged
merged 2 commits into from
Jan 12, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Add compat disclaimer in docs about const field annotation
  • Loading branch information
jakobnissen committed Dec 27, 2021
commit 3911ba79eb5ff92875cd5f2cc8679a3e357019c8
3 changes: 3 additions & 0 deletions doc/src/manual/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ one can declare these fields as such using `const` as shown below. This enables
but not all of the optimizations of immutable structs, and can be used to enforce invariants
on the particular fields marked as `const`.

!!! compat "Julia 1.8"
`const` annotating fields of mutable structs requires at least Julia 1.8.

```jldoctest baztype
julia> mutable struct Baz
a::Int
Expand Down