zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Should (t)path = array-unique-special work this way
Date: Fri, 05 Feb 2016 18:19:53 +0000	[thread overview]
Message-ID: <20160205181953.7e61f352@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20160205174624.60fd0203@pwslap01u.europe.root.pri>

On Fri, 5 Feb 2016 17:46:24 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> On Fri, 05 Feb 2016 18:34:06 +0100
> Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
> > That was my question. The path has *-unique in type, this could be
> > viewed as a guard that no repetition is possible, but the guard is
> > avoided by assigning to PATH. That's from one point of view
> > unexpected.
> 
> It wasn't your question, but you can of course make PATH unique too, and
> I suppose an additional lesson is that for least surprises you might
> want always to do
> 
> typeset -U path PATH

The behaviour doesn't look like it's documented, at least not in the
obvious place.  The language might be a bit clunky for a shell manual.

diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index fb630a7..a15f4c2 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1980,6 +1980,11 @@ item(tt(-U))(
 For arrays (but not for associative arrays), keep only the first
 occurrence of each duplicated value.  This may also be set for
 colon-separated special parameters like tt(PATH) or tt(FIGNORE), etc.
+Note the flag takes effect on assignment, and the type of the
+variable being assigned to is determinative; for variables with
+shared values it is therefore recommended to set the flag for
+all interfaces, e.g. `tt(typeset -U PATH path)'.
+
 This flag has a different meaning when used with tt(-f); see below.
 )
 item(tt(-Z) [ var(n) ])(


  reply	other threads:[~2016-02-05 18:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 13:45 Sebastian Gniazdowski
2016-02-05 17:15 ` Bart Schaefer
2016-02-05 17:34   ` Sebastian Gniazdowski
2016-02-05 17:46     ` Peter Stephenson
2016-02-05 18:19       ` Peter Stephenson [this message]
2016-02-14 10:04   ` Sebastian Gniazdowski
2016-02-14 10:19     ` Sebastian Gniazdowski
2016-02-14 14:34     ` Daniel Shahaf
2016-02-14 18:44     ` Bart Schaefer
2016-02-15  8:25       ` Sebastian Gniazdowski

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=20160205181953.7e61f352@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).