Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
- X-seq: zsh-workers 41303
- From: Sebastian Gniazdowski <psprint@xxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
- Date: Thu, 15 Jun 2017 08:03:01 +0200
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- In-reply-to: <CAH+w=7aGkJpWqM=2QEz_SgFokwNSxfok7WA2v6Uv=Fw6P3Skcg@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <etPan.59416db1.2eb141f2.8fd5@MacMini.local> <CAH+w=7aGkJpWqM=2QEz_SgFokwNSxfok7WA2v6Uv=Fw6P3Skcg@mail.gmail.com>
On 14-06-2017 at 22:35:51, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> On Wed, Jun 14, 2017 at 10:09 AM, Sebastian Gniazdowski
> wrote:
> > Hello,
> > % zsh-5.3.1
> > % var_name="abcdef"; array=( "${(PA@)var_name}" ); echo ${#array}
> > 1
>
> The (A) flag doesn't mean anything in this context in 5.3.1, that was
> added about 2 months after the 5.3.1 release.
I suspect it was this patch about using A outside ::= context.
> So in the above example ${(P)var_name} returns a scalar and the (@)
> flag is also meaningless. In this next example --
I think @ has an actual effect:
> zsh-5.1.1
> abcdef=( a b ); var_name="abcdef"; array=( "${(PA@)var_name}" ); echo ${#array}
2
> ... array=( "${(P@)var_name}" ); echo ${#array}
2
> ... array=( "${(PA)var_name}" ); echo ${#array}
1
> ... array=( "${(P)var_name}" ); echo ${#array}
1
> resolve to nothing rather than to a quoted empty string, just as
> "${emptyarray[@]}" would do.
Yes it's a change for the better.
--
Sebastian Gniazdowski
psprint /at/ zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author