zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: LOCAL_VARS option ?
Date: Thu, 19 Jan 2017 21:01:41 -0800 (PST)	[thread overview]
Message-ID: <alpine.LRH.2.00.1701192046340.4560@toltec.zanshin.com> (raw)
In-Reply-To: <20170119160841.354ec75c@pwslap01u.europe.root.pri>

On Thu, 19 Jan 2017, Peter Stephenson wrote:

> On Thu, 19 Jan 2017 07:47:53 -0800
> Bart Schaefer <schaefer@brasslantern.com> wrote:
> > 2. Unlike local_options, which applies when the function exits, this has
> >    to be applied when the parameter is created.  There's already a
> >    mechanism to accomplish this, namely to declare the parameter.  The
> >    only reason to need local_vars is to change the semantics of *other*
> >    functions [see (1)], which is generally a bad idea.
>
> Hmmm... I suspect people would want to set it to protect their own
> functions

That's what zsh/param/private is for ...

> > 5. (New since the last time this was discussed) The type of problem this
> >    "solves" is generally better addressed by WARN_CREATE_GLOBAL so that
> >    proper use of parameter declarations can be applied.
>
> Yes, that makes a difference, but it doesn't detect the case where you
> re-use a variable in a nested function without redeclaring it.  (That
> can be done, too, by comparing variable levels, but it's a significantly
> more intrusive option --- consider the completion system.)

Perhaps rather than a setopt, this could be a property of functions --
something like "typeset -fT" so limited to the single function to which
it is applied.  That could be appropriate either for a generic "used
but not declared local" warning or the "implicit local var" feature,
though I would still have reservations about the latter.

Anyway the point is that we should make it easier to debug these issues
rather than make it easier to sweep them under the proverbial rug.


  reply	other threads:[~2017-01-20  5:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170119070023epcas3p17d787fb31e7c04d5bcf2231020769b5f@epcas3p1.samsung.com>
2017-01-19  6:54 ` Daniel Shahaf
2017-01-19  9:43   ` Jens Elkner
2017-01-19  9:45   ` Peter Stephenson
2017-01-19 15:47   ` Bart Schaefer
2017-01-19 16:08     ` Peter Stephenson
2017-01-20  5:01       ` Bart Schaefer [this message]
2017-01-20 17:19         ` Peter Stephenson
2017-01-22 18:45           ` Bart Schaefer
2017-01-22 19:00             ` Peter Stephenson
2017-01-23 10:09               ` Peter Stephenson
2017-01-23 11:20                 ` Daniel Shahaf
2017-01-23 11:37                   ` Peter Stephenson
2017-01-25  5:50                   ` Daniel Shahaf
2017-01-25  9:24                     ` Peter Stephenson
2017-01-25 19:32                       ` Daniel Shahaf
2017-01-25 21:50                         ` Bart Schaefer
2017-01-29 21:21                           ` Daniel Shahaf
2017-01-26 19:43                       ` Peter Stephenson
2017-01-26 20:04                         ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.00.1701192046340.4560@toltec.zanshin.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).