zsh-users
 help / color / mirror / code / Atom feed
From: jsks <js.shirin@gmail.com>
To: zsh-users@zsh.org
Cc: Joshua Krusell <js.shirin@gmail.com>
Subject: unset private variables
Date: Sun, 3 Sep 2023 14:06:15 +0200	[thread overview]
Message-ID: <CAOCbtnswt_UYR8psp2sMDT=AYZOVJxmdq92P3jBP=dFghaQmLg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

Hi,

Apologizes if I missed something in the documentation, but I'm running into
the following problem and wondering what is the intended behaviour.

Unsetting a variable declared with param/private and then modifying it
returns the error "can't change parameter attribute". Declaring using
`local` works, however, and preserves the `local-scalar` attribute.

Example code, run on zsh-5.9:

zmodload zsh/param/private
function foo() {
    private x=1
    unset x
    x=2
}
foo

/Joshua

[-- Attachment #2: Type: text/html, Size: 700 bytes --]

             reply	other threads:[~2023-09-03 12:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-03 12:06 jsks [this message]
2023-09-03 18:02 ` Bart Schaefer
2023-09-03 18: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='CAOCbtnswt_UYR8psp2sMDT=AYZOVJxmdq92P3jBP=dFghaQmLg@mail.gmail.com' \
    --to=js.shirin@gmail.com \
    --cc=zsh-users@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).