That issue discussion appears to be completely beside the point?
Base.RefValue
is basically the equivalent of mutable struct GenericContainer{T} contents::T end
, with some slightly different extra sugar, broadcasting behavior, ccall behavior built in, and no ceremony.
Why would you put a Ref into an immutable struct? Obviously because your program logic wants to put references to the same shared mutable state into many different immutable structs, duh! Same reason why you would put any mutable struct into an immutable one.
That’s eminently sensible.
You can do that, but it’s less efficient / eats more memory / has an extra allocation + pointer indirection.