On 03/18/2017 12:19 PM, Chet Ramey wrote: > On 3/17/17 6:35 PM, Dan Douglas wrote: > >> The problem is the non-obvious nature of unset's interaction with scope, >> (and the lack of documentation). Not much can be done about the former, >> as it is with so many things. > > How would you suggest improving the documentation? I can see highlighting > the fact that unset applied to a local variable at the same scope > preserves the local attribute. What else? >
The effect of unset on a local was what I had in mind, but really the manual says very little about scope. All it says right now is: "Variables local to the function may be declared with the local builtin command. Ordinarily, variables and their values are shared between the function and its caller." Which doesn't exactly describe dynamic scope even for those that know what that means. Also not documented is how a variable declared with declare/typeset is distinct from an unset variable.