From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17680 invoked by alias); 22 Jan 2017 19:08:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40395 Received: (qmail 23207 invoked from network); 22 Jan 2017 19:08:01 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-4.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(80.0.253.68):SA:0(-1.2/5.0):. Processed in 1.44743 secs); 22 Jan 2017 19:08:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _smtprelay.virginmedia.com designates 80.0.253.68 as permitted sender) X-Originating-IP: [86.21.219.59] X-Spam: 0 X-Authority: v=2.1 cv=KLKndwxo c=1 sm=1 tr=0 a=utowdAHh8RITBM/6U1BPxA==:117 a=utowdAHh8RITBM/6U1BPxA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=MWUjAzoEKyAA:10 a=q2GGsy2AAAAA:8 a=LHmOcudEyG9pJQVhRhgA:9 a=CjuIK1q_8ugA:10 a=z9dJwno5l634igLiVhy-:22 Date: Sun, 22 Jan 2017 19:00:52 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: LOCAL_VARS option ? Message-ID: <20170122190052.327898df@ntlworld.com> In-Reply-To: References: <20170119065408.GA5534@fujitsu.shahaf.local2> <20170119160841.354ec75c@pwslap01u.europe.root.pri> <20170120171922.0e0c370d@pwslap01u.europe.root.pri> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 22 Jan 2017 10:45:21 -0800 (PST) Bart Schaefer wrote: > On Fri, 20 Jan 2017, Peter Stephenson wrote: > > > Here's a first go at the warning option, with "functions -W" to turn it on > > in the same fashion as "functions -T". The option is called > > WARN_NESTED_VAR for now. > > This is almost exactly what I was thinking ... except I wasn't thinking > of it having a name that could be accessed with setopt. I was thinking > more of something that could ONLY be activated by "functions -W". I did think about this. The other way just gives a hidden variable which is still there but you can't access, so the shell sort of had the capability to apply this to a whole hierarchy of functions at once but you couldn't actually use it. That didn't seem particularly useful. > Possible logical extensions would be to warn only if the variable is > truly in global scope, or to warn only if the variable is NOT in global > scope (i.e., is local to some caller's scope). If -W were implemented > in some other way than as a setopt, it could accept arguments (along > the lines of gcc -W...) to indicate different kinds of warnings. I'm not sure I'd want it to be complicated enough not to be at least encodable as an option, though as it's for debugging I suppose it's not that big a deal. We've got a byte's worth of data with options we could use more expressively anyway. I think we've vaguely discussed this before. pws