function f {
typeset -n ref
typeset var=foo
ref=$1
echo ref=$ref
ref=var
echo ref=$ref
}
In this call to foo the first assignment to ref (ref=$1) initializes the reference and the second one (ref=var) assigns the string var to the referred variable.
In this call to foo, the first assignemnt to ref has no effect and the second one becomes an initialization of ref. I find this very surprising. In my opinion, only the first assignment to an uninitialized named reference should ever be an initialization of the named reference.
Here is what ksh does:
$ f ""
ksh: f: line 4: : invalid variable name
I think that this is much better and that Zsh should do the same,
Philippe