I would also like it if bash would provide a way to safely interpolate
empty arrays with set -u. Syntax idea:
echo "${A[@@]}"
That way there is no extra mode, which is harder to read IMO.
Given that I already complained that it takes 8 punctuation characters to
interpolate an array and 10 to copy it [1], I should take this suggestion back.
A simpler and backward compatible syntax would be:
echo "address@hidden" # like "address@hidden" but an empty array OK with set
-u
I was thinking of using that syntax for arrays in OSH. And if you have arrays, you don't really
need word splitting, so you can argue that address@hidden (no quotes) should be the same as
"address@hidden". It's less consistent, but then the common case with fewer characters
is correct. Or I might just leave out address@hidden (syntax error) and only provide
"address@hidden".
Andy
[1] http://www.oilshell.org/blog/2016/11/06.html