zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Named reference typos & misc.
Date: Wed, 15 Feb 2023 06:58:35 -0800	[thread overview]
Message-ID: <CAH+w=7Yy-PfNZ0a6excUXxX-Q6=Yktw0hgkbisgSqSVKbSuNvA@mail.gmail.com> (raw)
In-Reply-To: <257116129.2947501.1676457402764@mail.virginmedia.com>

On Wed, Feb 15, 2023 at 2:37 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
>
> > On 15/02/2023 10:12 Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> >
> > On 14/02/2023 20:00 Bart Schaefer <schaefer@brasslantern.com> wrote:
> > > Unrelated:
> > > > I kept the loop in the function to avoid a (correct) additional warning
> > > > message setting the global variable ref in the loop.  I don't know if
> > > > setting ref in a for loop should actually elide that message, which
> > > > is a completely separate issue.
> > >
> > > You mean an assignment within the loop, while "ref" already points out
> > > of it?  I would think that'd be expected to trigger warn_create_global
> > > instead,
> >
> > Yes, and it usually does with normal references, so I guess there's a
> > different case here with namerefs.
>
> "... with normal VARIABLES", sorry, that's confusing the issue.

% () {
function> typeset -n ref
function> setopt warncreateglobal
function> for ref in a b c; ref=$((++i))
function> }
(anon):3: numeric parameter i created globally in function (anon)
(anon):3: scalar parameter a created globally in function (anon)
(anon):3: scalar parameter b created globally in function (anon)
(anon):3: scalar parameter c created globally in function (anon)
% typeset -p a b c
typeset a=1
typeset b=2
typeset c=3

I think this is working as would be expected.


      reply	other threads:[~2023-02-15 14:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  2:08 Bart Schaefer
2023-02-14 14:46 ` Peter Stephenson
2023-02-14 16:14   ` Bart Schaefer
2023-02-14 16:36     ` Peter Stephenson
2023-02-14 20:00       ` Bart Schaefer
2023-02-15  1:39         ` Bart Schaefer
2023-02-16 15:29           ` zmodload (-u?) changing options (was Re: [PATCH] Named reference typos & misc.) Bart Schaefer
2023-02-16 15:52             ` Peter Stephenson
2023-02-16 18:17               ` Bart Schaefer
2023-02-16 19:28                 ` Bart Schaefer
2023-02-16 23:10                 ` Bart Schaefer
2023-02-21 11:47                 ` Peter Stephenson
2023-02-21 12:11                   ` Peter Stephenson
2023-02-21 15:57                     ` Bart Schaefer
2023-02-15 10:12         ` [PATCH] Named reference typos & misc Peter Stephenson
2023-02-15 10:36           ` Peter Stephenson
2023-02-15 14:58             ` Bart Schaefer [this message]

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='CAH+w=7Yy-PfNZ0a6excUXxX-Q6=Yktw0hgkbisgSqSVKbSuNvA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=p.w.stephenson@ntlworld.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).