What is the most straightforward way to make a variable in the global scope 
that can change it's value, but not its type? So far I use this: 

const GLOBAL_VAR = [MyType[]]  # array with single element

set_global_var(x::MyType) = GLOBAL_VAR[1] = x
get_goval_var() = GLOBAL_VAR[1]

This works fine and preserves type stability, but looks quite unintuitive. 
Is there more standard container or another way (e.g. type assertions or 
something) to handle such cases? 



Reply via email to