We can do this in a backward-compatible manner. By only managing the memory for the variables that are defined using Var{:scope}()
for named scopes and Var()
for local scopes.
We can easily set limitations for the developers then. They should not call @eval
in a scope that uses Var
(we can return an error), they should manage global variables manually, and any other situation that we think we cannot handle automatically.
By setting these limitations I cannot think of any code that breaks. Either someone wants automatic memory management and follows the limitations or they should use GC.