Phil suggested on IRC a LOCAL_VARS option that has the effect of making all newly-declared variables local; e.g., % unset x y % () { setopt localvars; x=42; typeset -g y=43 } % echo $+x $+y 0 1 % I'm attaching a proof of concept patch (work in progress; see top of the attachment for known issues), but WDYT of the the general concept?