From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25851 invoked by alias); 14 Feb 2016 14:41:26 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37969 Received: (qmail 318 invoked from network); 14 Feb 2016 14:41:25 -0000 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 Date: Sun, 14 Feb 2016 14:34:43 +0000 From: Daniel Shahaf To: Sebastian Gniazdowski Cc: Zsh hackers list Subject: Re: Should (t)path = array-unique-special work this way Message-ID: <20160214143443.GA6138@tarsus.local2> References: <160205091543.ZM29723@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sebastian Gniazdowski wrote on Sun, Feb 14, 2016 at 11:04:02 +0100: > On 5 February 2016 at 18:15, Bart Schaefer wrote: > > > > Q: Why doesn't -U appear in the "declare -p" output? > > A: Good question. It doesn't appear for non-special arrays either. It > > may be intentional because -U isn't a POSIX-supported option, but I > > suspect it's just an accidental omission. > > Wanted to write a snapshot feature, basically declare -p > snapshot; > setopt typesetsilent; source ./snapshot, but the omission of -U is > quite a blocker. Other interesting thing is that typeset -a a doesn't > fully redefine a, uniqueness still holds if it was present. If the parameter already exists, 'typeset' will modify it rather than replace it. For example, 'typeset x=foo; readonly x; echo $x' prints 'foo' rather than an empty string. You might need to call 'unset' before calling 'typeset'? I'm not sure whether that has any edgecases to beware of.