Closed
Description
openedon Aug 26, 2020
Apologies if there's already an issue open for this already. I took a quick look but.
Many times when I define a mutable struct, but I know there's only one or two fields in it that will ever change, I feel slightly guilty. I suspect there must be optimizations that could become available if Julia knew which of the fields might change, and which might not. For example, in the following example, perhaps I know that b
might change, but a
will not.
mutable struct A
a::Int
b::Int
end
So I could imagine writing it like this instead:
struct A
a::Int
mutable b::Int
end
Of course, it's possible to make b
a Ref
, but perhaps the solution above seems a bit more general?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels