From b0fa403a3da0f01cb75eeea701c652b007b5db1b Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 12 May 2025 21:29:16 -0700 Subject: 53602: "typeset -nu" always refers to at a call level above the declaration --- Doc/Zsh/func.yo | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Doc') diff --git a/Doc/Zsh/func.yo b/Doc/Zsh/func.yo index 7b71e34e9..9558b11c4 100644 --- a/Doc/Zsh/func.yo +++ b/Doc/Zsh/func.yo @@ -23,9 +23,11 @@ declared in an earlier function scope. (See noderef(Local Parameters).) A named parameter declared with the `tt(-n)' option to any of the -`tt(typeset)' commands becomes a reference to a parameter in scope at -the time of assignment to the named reference, which may be at a -different call level than the declaring function. For this reason, +`tt(typeset)' acts as a reference to another parameter, which may +be at a different call level than the declaring function. When the +`tt(-u)' option is also given, the referenced parameter is always +found at a call level above the function where the reference is +declared, otherwise the reference scope is dynamic. For this reason, it is good practice to declare a named reference as soon as the referent parameter is in scope, and as early as possible in the function if the reference is to a parameter in a calling scope. -- cgit v1.2.3-70-g09d2