Proposal for deterministic memory management

We can make the previous example static by considering the worst case (outer scope). Scope of a and b can be found from the user’s code.

Worst case for this particular example is that v becomes global and so it should be deleted manually.

# lowered static code:
const global_var = []  # Var{:global}
function f(a,b)
    v = Any[1]
    rand(Bool) && push!(a, v)
    rand(Bool) && push!(b, v)  
    rand(Bool) && push!(global_var, v)  # worst case v becomes Var{:global}
    rand(Bool) && push!(v, v)
    rand(Bool) ? do_something(v) : do_something_else(v)
end

# v should be deleted manually