Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Possibly excessive WARN_CREATE_GLOBAL
- X-seq: zsh-workers 37196
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Possibly excessive WARN_CREATE_GLOBAL
- Date: Sun, 22 Nov 2015 11:04:06 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=QdWIZLCc5/f0FLbUQY1OEA+yAZg//EicuYgC7O754pU=; b=kSdSWn1+ISpRnO3BhUym3vtrdzQvbm9aGdhb9pZaG9/yjyJD/CpB1dZwVwoSgW66ft QvtraWIJxKtGddi37akJsDfGJtZIxNiMEulxMkIQGXFBg2Xq3aHhE9Ur3MF3RIidLRel qNIo0tzKpIWm2U5miuE+qxtPrNk28sR9NWrSLgWnnB7VhsW0+C24jz3it3GIvUtHW72o VZaXrlGJqWQYRBLEm/WpJNMFakr7A+Lw3Bvt4fncHqvc3DlJJcP5NwvSfqFI6aWjfmER 1sxi/0EAAtHT7oW3YrWVbiktwD7nmP50sygxfsq+OTH76JNG7SeMpK1jMMQ/Jx182OFf 1IPw==
- In-reply-to: <20151122182755.2ad1cb72@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <151122095213.ZM10080@torch.brasslantern.com> <20151122182755.2ad1cb72@ntlworld.com>
On Nov 22, 6:27pm, Peter Stephenson wrote:
} Subject: Re: Possibly excessive WARN_CREATE_GLOBAL
}
} On Sun, 22 Nov 2015 09:52:12 -0800
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > However, do we want to be complaining about REPLY, reply, match, mbegin,
} > mend, MBEGIN, MEND, and BASH_REMATCH?
}
} Yes, those are exactly the ones where it's important we do --- in fact,
} match etc. were in my mind when I introduced the option [...]
}
} (Unfortunately, in this example we don't actually get a warning for the
} inner scope if the outer function had already localised the variable
} [...]. You could argue for a warning "variable created in outer
} scope", I suppose.)
Hmm.
No time to fix it now, but declaring something "private" suppresses the
warncreateglobal warning without allowing the variable to become set in
the inner scope. (What SHOULD happen here? An error?)
torch% zmodload zsh/param/private
torch% setopt extendedglob warncreateglobal
torch% () {
local -P match
() {
[[ abc = (#b)*(?)* ]]
typeset -p match mbegin mend
}
print ${(t)match}
}
(anon):1: array parameter mbegin created globally in function (anon)
(anon):1: array parameter mend created globally in function (anon)
(anon):typeset:2: no such variable: match
typeset -a mbegin
mbegin=( 3 )
typeset -a mend
mend=( 3 )
scalar-local-hide-hideval-special
Messages sorted by:
Reverse Date,
Date,
Thread,
Author