Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: LOCAL_VARS option ?
On Sun, 22 Jan 2017 10:45:21 -0800 (PST)
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author