Does KSH_ARRAYS affect associative array semantics between zsh 5.8 and 5.9?
0 reputation · 06 Jun 2020, 23:48 UTC
When migrating from zsh 5.8 to 5.9, there are concerns regarding how empty associative arrays are handled when the KSH_ARRAYS option is enabled. While this option is intended to switch array indexing to 0-based, its interaction with associative array initialization appears inconsistent across these versions.
Specifically, scripts that rely on [[ -v assoc[key] ]] or [[ -n ${assoc[key]} ]] to verify the existence of empty keys may yield varying results. This suggests that changes in the zsh/parameter module in version 5.9 might alter how empty arrays are reported in the $parameters variable or via parameter expansion.
How does the setopt KSH_ARRAYS option change the behavior of empty associative arrays in zsh 5.9 compared to 5.8? Is there a standardized way to ensure [[ -v ]] behaves consistently regardless of the version or active setopts?