Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Hiding specials, and namerefs
- X-seq: zsh-workers 55016
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Hiding specials, and namerefs
- Date: Tue, 21 Jul 2026 13:08:33 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bmD7psaZx3xSQJUQEZlYU5C0GgblsttGldSaax6LLFI=; fh=BgAYDYpL6Ne/A5nWEMVJiHiBtrz8Imz3uf26RDwgQX4=; b=W7E+L3qPQqCplF115YBe6uIn/KWBGgIJG43k7A1d5ft4udOXYWxCGoWdGQ2R4fCPwO 5vTyeXLukn35skXYS/W97BO9gdl6zER8EcbBUGd8OORC14+tyWFgip/3FTgKmAohoLxx SrEwCb5b9pN79nIUYWgnGVP7D+FOcm7H1zLYJrhRR8fn615LRjsHIO+j7oOSgn/nJU80 mCXhSvBiVTK3OM7qbfSEYXU1SmB/jeIgU6KlKQPl6VIWQ4yMz4GESg7kBTcR1IDbnTLG nahJUV677/m7zPWmAX6+RpVt0lzAiN86rRWQbEcG+Ub07JYysYMjVe6DOQBkfave4//C zHxg==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1784664525; cv=none; d=google.com; s=arc-20260327; b=BCDHAuXIZ/k/xCb4rn+JoJbUQLwngFk4RR4OGgkV0LCe+67mUVfAjsl91bvQU2X0iH jRWM1OpJNDkUIOBlXfX3GCp7OhlX0/3lsdTZF39u8P0WdEfgsC/t6rz43BFL6KO9FdxG ljmscmYlr3JlwjsEA2ju1hQjQ2yEaTXHfgVv3cU9g+2eYN+lAjS6YJIjV/Pg0qBiGLpn KaBd7MsaACFfNyj74c+jem8xb+4eO/iTU480a4LPFTuJgVw+E5YdatrR2VcB5vccF+Kk 0RFkrbJ99/YHMNZ+0dkM9osIj5fgV3Sg34UzU0YDKxP/E1pw2iHvS4vv9lnzN3nfwKXr /b+w==
- Archived-at: <https://zsh.org/workers/55016>
- In-reply-to: <CAGdYchtAinCGigWFjq1uTawpuTsG+Zgb8w0gY2_JadhOXuaWtQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAH+w=7ZVUPRKBpRVOGX4eSqbKNFyt8PrYC4r37GMGu1KJO8Egg@mail.gmail.com> <CAHYJk3SP_uEk8YTCpExj2fYi7uKyMRYA389zUWVyUGqx+VhJ=Q@mail.gmail.com> <CAGdYchtAinCGigWFjq1uTawpuTsG+Zgb8w0gY2_JadhOXuaWtQ@mail.gmail.com>
On Mon, Jul 20, 2026 at 5:46 PM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> I assume that's what pm->level = locallevel + 1 in function makezleparams achieves.
Yes.
> Now, speaking of special parameters, could anyone explain to me what is supposed to happen if one declares without -h a local parameter with the same name as a special parameter?
>
> The documentation suggests that without -h the local parameter keeps the special effects of the enclosing special parameter.
That's the intention. I believe the expectation is that one can e.g.
create a scoped $path that resets on exit from the scope. There are
probably some specials that have since been introduced where this
doesn't make as much sense. (Where "since" is a freakishly long time,
really.)
> How is that possible? How can the new parameter have its own state but still have the special effects? Is it because the local parameter reuses the same gsu but gets its own u?
If you look at createparam(), assigngetset() is not called for
specials, so yes, the local parameter re-uses the gsu.
> Or, is the special paramater's u being saved, reused and restored when the local parameter goes away?
This happens the same way as with any other local.
> How is it possible to have multiple instances of the same special parameter that each have their own state when there is a single C variable to back them?
[...]
> This shows that there are two states but apparently both are somehow connected to the C home variable. Thanks to references, it's possible to access both parameters from within the same scope. What is supposed to happen if we try that?
Honestly I don't think up-references to unhidden specials was ever
considered. They should probably just be disallowed, there is no
provision for two accessible parameters to have the same backing
state.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author