Still one more way to get a write access through encapsulation is using structs:
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 personally would prefer this one from the point of view of readability, especially if the module contains more than one state variable.