You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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, buta
will not.So I could imagine writing it like this instead:
Of course, it's possible to make
b
aRef
, but perhaps the solution above seems a bit more general?The text was updated successfully, but these errors were encountered: