zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] zsh/param/private scoping error
Date: Mon, 4 Oct 2021 06:54:54 +0200	[thread overview]
Message-ID: <CAHYJk3T2skWKKVsh-PLnE_=E_2nNtoePGD_5ErFmmKEmo5WqMQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7aRHM0XoovCACnOwdSGHM96=aCWZBw+32GtNbuvR5CReA@mail.gmail.com>

On 10/3/21, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Wed, Sep 1, 2021 at 10:35 AM Bart Schaefer <schaefer@brasslantern.com>
> wrote:
>>
>> Something else has changed since the implementation of private, I
>> think, because this is not what I expected:
>>
>> top () { private foo=top; mid }
>> mid () { typeset -g foo=middle; bot }
>> bot () { print $foo }
>> functions -t top
>
> The attached patch addresses this, producing the output I expected:
>
> +top:0> private foo=top
> +top:0> mid
> +mid:0> typeset -g foo=middle
> +mid:0> bot
> +bot:0> print middle
> middle
>
> It also improves the error message in the event that a typeset
> attempts to change the scope or properties of a private parameter.
>
>> Even
>> without private, "typeset -g" only reaches as far upwards as the most
>> recent local declaration of the name.
>
> A documentation patch to better explain this is included.  As a bonus,
> there's also an explanation of why some parameters do not appear in
> "typeset -p" output.

+private parameters cannot be reliably be reloaded.  This also applies

This sentence has an extra "be".

-- 
Mikael Magnusson


  reply	other threads:[~2021-10-04  4:55 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
2021-09-01 17:35         ` Bart Schaefer
2021-10-03 21:55           ` Bart Schaefer
2021-10-04  4:54             ` Mikael Magnusson [this message]
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='CAHYJk3T2skWKKVsh-PLnE_=E_2nNtoePGD_5ErFmmKEmo5WqMQ@mail.gmail.com' \
    --to=mikachu@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).