and what your solution could look like? I would use something like ___untie_array and ___untie_scalar that I would never use outside the untie function, but I wonder if there is a more general solution Il giorno sab 21 gen 2023 alle 20:16 Roman Perepelitsa < roman.perepelitsa@gmail.com> ha scritto: > On Sat, Jan 21, 2023 at 7:53 PM Bart Schaefer > wrote: > > > > Speaking of unorthodoxy ... > > > > untie () { > > emulate -L zsh > > case ${(tP)1} in > > (scalar-tied) > > local scalar=${(P)1} > > unset $1 > > typeset -g $1=$scalar > > ;; > > (array-tied) > > local array=( ${(P)1} ) > > unset $1 > > # Need eval here for array assignment, as > > # reserved word doesn't work with $1=(...) > > eval "typeset -ga $1=( \$array )" > > ;; > > (*) ;; > > esac > > } > > Bravo. > > `untie scalar` and `untie array` won't work due to name clashes but > this seems easily fixable. > > Roman. > > -- Pier Paolo Grassi