Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Too much NO_UNSET? (was Re: Weird error: opts[(r)-e]: parameter not set)



} On Sat, Oct 29, 2016, at 10:03 AM, Bart Schaefer wrote:
} > The NO_UNSET option complains not just when the array itself is not
} > declared, but whenever there is a dereference of an array element
} > that does not exist.

I wonder if NO_UNSET is a little too aggressive.  For example, the following
does not seem particularly desirable:

torch% () { setopt nounset; echo $3 }
(anon): 3: parameter not set

I'm undecided on whether array elements in general should be protected from
the warning if the array itself is set, or only the positional parameters
need special handling.  On the other hand, I can see it being quite useful
to get the warning for *associative* array elements that aren't set.

Discuss?



Messages sorted by: Reverse Date, Date, Thread, Author