From fa4c88ca25f587f52074698d4ff7eb263de07930 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 4 Oct 2021 09:02:27 -0700 Subject: 49456: clean up detection of private params in nested scopes, update doc --- Doc/Zsh/mod_private.yo | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Doc/Zsh/mod_private.yo') diff --git a/Doc/Zsh/mod_private.yo b/Doc/Zsh/mod_private.yo index 78aee0acf..184fa2be8 100644 --- a/Doc/Zsh/mod_private.yo +++ b/Doc/Zsh/mod_private.yo @@ -10,12 +10,16 @@ ifnzman() startitem() findex(private) cindex(private parameter, creating) -item(tt(private) [ {tt(PLUS())|tt(-)}tt(AHUahlprtux) ] \ +item(tt(private) [ {tt(PLUS())|tt(-)}tt(AHUahlmrtux) ] \ [ {tt(PLUS())|tt(-)}tt(EFLRZi) [ var(n) ] ] [ var(name)[tt(=)var(value)] ... ])( The tt(private) builtin accepts all the same options and arguments as tt(local) (ifzman(zmanref(zshbuiltins))ifnzman(noderef(Shell Builtin Commands))) except for the `tt(-)tt(T)' option. Tied parameters may not be made private. +The `tt(-)tt(p)' option is presently a no-op because the state of +private parameters cannot reliably be reloaded. This also applies +to printing private parameters with `tt(typeset -p)'. + If used at the top level (outside a function scope), tt(private) creates a normal parameter in the same manner as tt(declare) or tt(typeset). A warning about this is printed if tt(WARN_CREATE_GLOBAL) is set @@ -75,7 +79,8 @@ itemiz(Within any other function called by the declaring function, the private parameter does em(NOT) hide other parameters of the same name, so for example a global parameter of the same name is visible and may be assigned or unset. This includes calls to anonymous functions, although -that may also change in the future.) +that may also change in the future. However, the private name may not be +created outside the local scope when it was not previously declared.) itemiz(An exported private remains in the environment of inner scopes but appears unset for the current shell in those scopes. Generally, exporting private parameters should be avoided.) -- cgit 1.4.1