zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Sebastian Gniazdowski <psprint@zdharma.org>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
Date: Wed, 14 Jun 2017 13:35:47 -0700	[thread overview]
Message-ID: <CAH+w=7aGkJpWqM=2QEz_SgFokwNSxfok7WA2v6Uv=Fw6P3Skcg@mail.gmail.com> (raw)
In-Reply-To: <etPan.59416db1.2eb141f2.8fd5@MacMini.local>

On Wed, Jun 14, 2017 at 10:09 AM, Sebastian Gniazdowski
<psprint@zdharma.org> 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.

So in the above example ${(P)var_name} returns a scalar and the (@)
flag is also meaningless.  In this next example --

> % zsh-5.3.1-dev-0
> % var_name="abcdef"; array=( "${(PA@)var_name}" ); echo ${#array}
> 0

-- the (A) flag does apply , so ${(PA)var_name} is an empty array
rather than an unset scalar, and (@) causes the double-quotes to
resolve to nothing rather than to a quoted empty string, just as
"${emptyarray[@]}" would do.


  reply	other threads:[~2017-06-14 20:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 17:09 Sebastian Gniazdowski
2017-06-14 20:35 ` Bart Schaefer [this message]
2017-06-15  6:03   ` Sebastian Gniazdowski
2017-06-15  6:10     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7aGkJpWqM=2QEz_SgFokwNSxfok7WA2v6Uv=Fw6P3Skcg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=psprint@zdharma.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).