As for using structs: Just posted an implementation in some other context.
the same code as in the link above
module Md2
Base.@kwdef mutable struct State
b1::Bool = false
b2::Bool = false
end
const st = State()
export st
end
using .Md2
julia> st.b1
false
julia> st.b1=true;
julia> st.b1
true
I my use case the performance was not relevant - but it is interesting to know how this way of encapsulation of variables into const
objects compares with using Ref
, array etc.