Why is Ref() not reflecting the changes

If I just copy paste your code into the REPL I get what you (and I) would expect, not what you wrote:

julia> mutable struct CommBoard
           orders::Array{Int,1}

           function CommBoard()
               new(Array{Int,1}([]))
           end
       end

julia> comm = CommBoard()
CommBoard(Int64[])

julia> comm.orders = [20,35]
2-element Vector{Int64}:
 20
 35

julia> mycomm = Ref(comm)
Base.RefValue{CommBoard}(CommBoard([20, 35]))

julia> function init_comm(comm::CommBoard)
           comm.orders = []
           return nothing
       end
init_comm (generic function with 1 method)

julia> init_comm(comm)

julia> println(comm) #returns CommBoard(Int64[])
CommBoard(Int64[])

julia> println(mycomm[]) #returns CommBoard(Int64[])
CommBoard(Int64[])

julia> comm.orders = [20,35]
2-element Vector{Int64}:
 20
 35

julia> println(comm) #returns CommBoard(Int64[20,35])
CommBoard([20, 35])

julia> println(mycomm[]) #returns CommBoard(Int64[])
CommBoard([20, 35])
2 Likes