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
Date: Sun, 14 Feb 2016 14:34:43 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Should (t)path = array-unique-special work this way
Message-ID: <20160214143443.GA6138@tarsus.local2>
References: <CAKc7PVCDHQDc=sby5wGNEtWCA6omFhmP8uPWbsPXwTQv9tDqFw@mail.gmail.com>
 <160205091543.ZM29723@torch.brasslantern.com>
 <CAKc7PVBrDBe-QQ5=3uC_G_eQSmg1MvSaG8QBdQN3Zn_htHkZmw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <CAKc7PVBrDBe-QQ5=3uC_G_eQSmg1MvSaG8QBdQN3Zn_htHkZmw@mail.gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 37969

Sebastian Gniazdowski wrote on Sun, Feb 14, 2016 at 11:04:02 +0100:
> On 5 February 2016 at 18:15, Bart Schaefer <schaefer@brasslantern.com> 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.

