Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Should (t)path = array-unique-special work this way



On 5 February 2016 at 18:15, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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.

% typeset -Ua a
% a=( a a )
% echo ${a[@]}
a
% declare -p > snapshot
% source ./snapshot
% a=( a a )
% echo ${a[@]}
a
% echo ${(t)a}
array-unique
% unset a
% source ./snapshot
% echo ${(t)a}
array
% a=( a a )
% echo ${a[@]}
a a

Best regards,
Sebastian Gniazdowski



Messages sorted by: Reverse Date, Date, Thread, Author