zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH 1/3] Extended ksh compatibility: namespace parameter syntax
Date: Fri, 19 May 2023 23:54:16 -0700	[thread overview]
Message-ID: <CAH+w=7bjStThTiTpEgem636Hr3Uev9CjLMUBhR1OWGNOvsfq4Q@mail.gmail.com> (raw)
In-Reply-To: <ZGgq/syXoXQF/pLl@fullerene.field.pennock-tech.net>

On Fri, May 19, 2023 at 7:06 PM Phil Pennock
<zsh-workers+phil.pennock@spodhuis.org> wrote:
>
> AFAICT, in zsh, .a.b=c is assigning to var b in namespace a, while a.b=c
> is setting the b attribute of the compound variable a.

As presently implemented, there's no difference.  The latter is
supported by the parser but should be considered a reserved syntax;
some sort of compound variable feature is a possible future
application.

> I think that you can use a set of namespaces for subsystems and have
> bound names (aliases) from the main namespace to those for existing
> behavior, unless an emulate directive says to be particularly strict.

Yes, that's one of the possible uses of named references.

> Then you could have the completion system switch away from littering the
> main namespace with _foo functions, by moving completion functions into
> the namespace

Function names already are (always were) more flexible than variable
names.  We could have used ".comp.foo" instead of "_foo" from the
beginning, if that had been thought more important than brevity at the
time.  In retrospect it might have been nice to have distinct
name(space)s for "completers" vs. "completion functions".

The missing bit for functions is that a leading "." doesn't hide the
function from the "functions" command the way it hides variables from
"typeset".

> and all sorts of cache variables there, which has the
> added bonus that leaks in user written completions won't pollute the
> main namespace.

Yes, there are a number of places where globals could benefit from hiding.


  reply	other threads:[~2023-05-20  6:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27  3:56 Bart Schaefer
2023-03-05  9:10 ` Oliver Kiddle
2023-03-05  9:57   ` Sebastian Gniazdowski
2023-03-05 20:20     ` Bart Schaefer
2023-03-05 21:11       ` Bart Schaefer
2023-03-05 20:16   ` Bart Schaefer
2023-03-05 22:24     ` Oliver Kiddle
2023-03-05 22:42       ` Bart Schaefer
2023-05-20  2:05         ` Phil Pennock
2023-05-20  6:54           ` Bart Schaefer [this message]
2023-05-20 17:32             ` Phil Pennock
2023-05-22  2:36               ` Mikael Magnusson
2023-05-22  4:35                 ` Bart Schaefer
2023-05-22 21:02                   ` Phil Pennock
2023-05-24 15:57                     ` Oliver Kiddle

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='CAH+w=7bjStThTiTpEgem636Hr3Uev9CjLMUBhR1OWGNOvsfq4Q@mail.gmail.com' \
    --to=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).