Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
X-AuditID: cbfec7f4-f79026d00000418a-99-56b4e7d887ba
Date: Fri, 05 Feb 2016 18:19:53 +0000
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
Message-id: <20160205181953.7e61f352@pwslap01u.europe.root.pri>
In-reply-to: <20160205174624.60fd0203@pwslap01u.europe.root.pri>
References:
 <CAKc7PVCDHQDc=sby5wGNEtWCA6omFhmP8uPWbsPXwTQv9tDqFw@mail.gmail.com>
 <160205091543.ZM29723@torch.brasslantern.com>
 <CAKc7PVDXYMJ7EtM-Cii-vAjuBxS9Ch4_xNiqTx-HAqQPeLBJAQ@mail.gmail.com>
 <20160205174624.60fd0203@pwslap01u.europe.root.pri>
Organization: Samsung Cambridge Solution Centre
X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu)
MIME-version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7bit
X-Brightmail-Tracker:
 H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xK7o3nm8JM/h4x9TiYPNDJgdGj1UH
	PzAFMEZx2aSk5mSWpRbp2yVwZTRPamUpOM9dceX1FeYGxs2cXYycHBICJhL9p84zQ9hiEhfu
	rWfrYuTiEBJYyijR+WoCO0hCSGAGk8T2ve4QidOMEreu7mGCcM4wSpzuXw5WxSKgKvHj9iRG
	EJtNwFBi6qbZYLaIgJbEjpMnmUBsYQEHiRnvIGxeAXuJaUtWgNmcQPEP6zazQwz9zyjRtuc6
	2FB+AX2Jq38/MUHcZy8x88oZRohmQYkfk++xgNjMQAs2b2tihbDlJTavecsMcba6xI27u9kn
	MArPQtIyC0nLLCQtCxiZVzGKppYmFxQnpeca6hUn5haX5qXrJefnbmKEBPSXHYyLj1kdYhTg
	YFTi4c1YvTlMiDWxrLgy9xCjBAezkggv18EtYUK8KYmVValF+fFFpTmpxYcYpTlYlMR55+56
	HyIkkJ5YkpqdmlqQWgSTZeLglGpg5NuaOj9n6XGPEJseJ6uG9Sf2/lsg/Xv2/ezzVUq57/2l
	G/6ft+tguTjjJvcKmU4N9ckRPAEqTQZfrM6cDC6ePP9nJavfJcmJMg++THPhqD7gHujAftxA
	Zq3Ni1MVh6VZQyTsGntPTTJwlH0ieN9b4Ni36xNs2c9X2C34416ReWbqNvvDBb3RSizFGYmG
	WsxFxYkAGZuwN2QCAAA=
X-Seq: zsh-workers 37893

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) ])(

