From: Mikael Magnusson <mikachu@gmail.com>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Bart Schaefer <schaefer@brasslantern.com>,
Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] zsh/param/private scoping error
Date: Wed, 1 Sep 2021 19:00:01 +0200 [thread overview]
Message-ID: <CAHYJk3SsTAGeUrBkrQRcpzcMPg0xjTEDBkHVBs8hATi8HzjhPA@mail.gmail.com> (raw)
In-Reply-To: <CAHLkEDsDLvy_cQ-HZaHo6i3FskL5FkY-_FU-wGse9jpaPkpayw@mail.gmail.com>
On 9/1/21, Marlon Richert <marlon.richert@gmail.com> wrote:
> On Wed, Sep 1, 2021 at 7:03 PM Mikael Magnusson <mikachu@gmail.com> wrote:
>> If private parameters
>> are only compatible with code that runs without warnings under setopt
>> WARN_CREATE_GLOBAL, then we should document this.
>
> That would largely defeat the purpose of private variables, wouldn't it? :)
Ah, I misinterpreted one of the examples, I thought that this would
work as you expect:
() { private foo; () { typeset -g foo=bar } }
(while this wouldn't:
() { private foo; () { foo=bar } }
)
But in both cases it is an error (although only the latter prints a
message and aborts execution), and foo is not set globally.
In fact a typeset -g is needed on the global level before the function
using private is called, which seems impossible for the innermost
function to enforce.
--
Mikael Magnusson
next prev parent reply other threads:[~2021-09-01 17:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 11:49 Marlon Richert
2021-09-01 14:09 ` Daniel Shahaf
2021-09-01 16:21 ` Marlon Richert
2021-09-01 14:39 ` Bart Schaefer
2021-09-01 16:03 ` Mikael Magnusson
2021-09-01 16:11 ` Marlon Richert
2021-09-01 17:00 ` Mikael Magnusson [this message]
2021-09-01 17:35 ` Bart Schaefer
2021-10-03 21:55 ` Bart Schaefer
2021-10-04 4:54 ` Mikael Magnusson
2021-10-04 15:12 ` Bart Schaefer
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=CAHYJk3SsTAGeUrBkrQRcpzcMPg0xjTEDBkHVBs8hATi8HzjhPA@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=marlon.richert@gmail.com \
--cc=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).