This package introduces the MutableScopedValue type which combines a RefValue and a ScopedValue. It aims to have the basic functionality of a ScopedValue but allow to also change it's value persistently outside of ScopedValues.with blocks.
It also defines a custom with method to allow mixing ScopedValues and MutableScopedValues within the same with call
This repo was initially named ScopedRefValues but was modified after the feeedback in https://discourse.julialang.org/t/change-scopedvalue-default-outside-of-with/130631
julia> using MutableScopedValues
julia> sv = MutableScopedValue{Float64}(3.0);
julia> sv[]
3.0
julia> sv[] = 5
5
julia> sv[]
5.0
julia> with(() -> sv[], sv => 1.0) # Setting with `with` has precedence over `setindex!`
1.0See the docstring for more details