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

Re: [PATCH] Documentation on (A) Create array parameter



On Feb 22,  3:40am, Sebastian Gniazdowski wrote:
}
} (A) completion and documentation suggest straight creation:

There's no such thing as "straight creation" of a parameter; the whole
shell model depends on dynamic scoping.  Assignments *always* apply to
any parameter that is already in scope, the only way to change that is 
by declaring the parameter with typeset/local/etc.

Furthermore, this specific instance is with reference to the earlier
documentation for ${NAME=WORD} et al. which says:

     In the first form, if NAME is unset then set it to WORD; in the
     second form, if NAME is unset or null then set it to WORD; and in
     the third form, unconditionally set NAME to WORD.

There'd be no point in calling out the difference between set, unset,
and set but null parameters if they were being "created" in the way you
have interpreted it here.

So if the use of the word "create" here is actually confusing, it's
that word that should be changed; clarifying semantics of dynamic
scoping is something for a much larger context.  Would it have led you
astray if instead the paragraph said "Assign as an array parameter ..." ?



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