Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why would I use .namespace.myvar?
On Sun, Mar 10, 2024 at 3:16 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> In a sentence or two, what is a namespace and why do we want it?
Quoting the updated FAQ file:
2.9: What is a `namespace' anyway?
As of this writing, namespaces in zsh are little more than syntactic
sugar for grouping related parameters. For example, as of the update
to PCRE2, the parameters ${.pcre.match} and ${.pcre.subject} are used
for regular expression substring capture. The `.pcre.' part is
the namespace, and when you refer to a parameter that has one, you
*must* use the `${...}' braces around the name. Assignments
are not special, they have the form `.nspace.var=value' as usual.
Parameters using a namespace have the additional property that, like
file names beginning with a dot for globbing, they're hidden from
`typeset' output unless explicitly asked for.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author