Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Namespaces (was Re: Remove support for named references to subscripted variables)
- X-seq: zsh-workers 54204
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Namespaces (was Re: Remove support for named references to subscripted variables)
- Date: Sat, 21 Feb 2026 17:16:49 -0800
- 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-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4Q52JlWN0XDfXH6op8RkgprFvjedRX239BSx4Tv+SSs=; fh=RngAOd9wlRc8Glv1v2GOfDUnq2FsyrczungEY8JNfXY=; b=JOhU3RIIgJxfCuX+Nu5/orWJsNz9bYQlpklFpjuQqDVQCdrHoB+ALiOugvovn9Jvsx Z/xREgI9jzvLQ63d9MMWbOwKL71te9S7Fo8w0kp/62ePMM9QWuaXZOXCOj9Z7VwJVMVZ dBCdvbIzclDfOMF30iETb6PznB1ReDMCdk9DfFeqGyNo/78hb3JFqiCST8um4TpE7y7b ELjSwMnbxlscX2B2PJpC/jjOVIQZpGk2gYp5E7kCBYSbZpcWeEL/hORE8B22+xs4OS+v XiHSzgOqagtLfcQRC56eq9WwZhMjG59y8Shps8w21M5hXZwFsegn66ndJ7Amh3uOwBz/ A5Yg==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1771723021; cv=none; d=google.com; s=arc-20240605; b=hwCNg+djUCc9i8EZyXazQd+VkuxrzAazbHVbEUTLjrPu5X3cH/Jt0QlLg1PhsGjiEg QNS5N3vWvSUf4fcsolxV7VzYaSXvWNeGQg/5kin9on17jRojwCwQEdbtkySfXT4u8upC Cl92NwX23Bw/lkfEG+lJ4JOG9mOFUBUy4t6EeMi51Ro3rqMY26I5NSNmPNQtvNDJD9IX 0HXPxrAOKn4J8va84ax2TzT36cCu2MEdux/yfKsIxloWO0eyonq0c09DRbh3Ocl3ox/+ y5Bx5MMnwUq/SdYB/5EU4AMFWDYLKThtuilksBo0OMEzgmOyfeaXGOWZm8qFmt0XgFjJ loVQ==
- Archived-at: <https://zsh.org/workers/54204>
- In-reply-to: <CAGdYchuK2-R5LfvCd8nAADR9=Q9Z=ptj_KPOShAFOTVC_rnq4A@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchshk3otx4WqD=_gb9_OMm1F-PW-hYUem92vLtzbR5iP1A@mail.gmail.com> <CAH+w=7YPMfCrK1MMh2kAJ8AkC4eE17RPztrKhGtDQ=K27Y5v3w@mail.gmail.com> <CAGdYchvGWzA4fk=tJFACmfkUoyD_PppRP38=Y+CEpX6yeY7r+g@mail.gmail.com> <CAH+w=7Yjw=Dgr-yp_XMzg8j=pWc9tVmecbYR-CCuwSY_d5kY6w@mail.gmail.com> <CAGdYchuK2-R5LfvCd8nAADR9=Q9Z=ptj_KPOShAFOTVC_rnq4A@mail.gmail.com>
On Wed, Feb 18, 2026 at 4:33 PM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> Given the description of namespaces in section 15.1, I'm surprised that ".foo" and "foo." are valid. I would have expected that names with namespaces must always contain two non-empty identifiers.
From Test/K02:
.k=OK
print ${.k}
0:Bare namespace is usable (ksh compatibility)
>OK
k.=empty
k.2=test
print ${k.} ${k.2}
0:Parse without leading dot (future proofing)
>empty test
This was all explained in the zsh-workers postings during the
development of namespaces, but the documentation discusses only the
parts that are guaranteed not to change in the future.
> I'm also a little surprised that the second identifier may start with a digit. I'll admit that there is nothing in the documentation that forbids it. It's just because identifiers usually have to start with a letter.
.not.2b=question
1:Identifier starting with a digit must be all digits, assignment
?(eval):1: not an identifier: .not.2b
The name following a namespace prefix has to fit the rules of a name
that does NOT have a namespace prefix. This is because a future
extension might introduce namespace scopes, e.g., the ksh-ish
construct
namespace foo {
echo In this block, $id is the same as ${.foo.id}
}
Since zsh allows assignment to positional parameters, the thought is
that one should be able to have "positional" names in a namespaces
(even though ksh does not).
> Finally, I'm more than a little surprised that "foo", ".foo" and "foo." are all valid but not ".foo.". Same for "foo.456", ".foo.456", and "foo.4ar", which are all valid but not ".foo.4ar".
foo.4ar should not be, but the "future proofing" parse mentioned in
the test case isn't following the full set of rules. Could probably
be tightened up.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author