zsh-workers
 help / color / mirror / code / Atom feed
* 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
@ 2017-06-14 17:09 Sebastian Gniazdowski
  2017-06-14 20:35 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Gniazdowski @ 2017-06-14 17:09 UTC (permalink / raw)
  To: zsh-workers

Hello,
% zsh-5.3.1
% var_name="abcdef"; array=( "${(PA@)var_name}" ); echo ${#array}
1

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

I am busy with valgrind test tool so I barely can bisect, can do this tomorrow if no resolution

--
Sebastian Gniazdowski
psprint /at/ zdharma.org


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
  2017-06-14 17:09 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" ) Sebastian Gniazdowski
@ 2017-06-14 20:35 ` Bart Schaefer
  2017-06-15  6:03   ` Sebastian Gniazdowski
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2017-06-14 20:35 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: zsh-workers

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
  2017-06-14 20:35 ` Bart Schaefer
@ 2017-06-15  6:03   ` Sebastian Gniazdowski
  2017-06-15  6:10     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Gniazdowski @ 2017-06-15  6:03 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

On 14-06-2017 at 22:35:51, Bart Schaefer (schaefer@brasslantern.com) 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
  2017-06-15  6:03   ` Sebastian Gniazdowski
@ 2017-06-15  6:10     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2017-06-15  6:10 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: zsh-workers

On Wed, Jun 14, 2017 at 11:03 PM, Sebastian Gniazdowski
<psprint@zdharma.org> wrote:
> On 14-06-2017 at 22:35:51, Bart Schaefer (schaefer@brasslantern.com) wrote:
>>
>> 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:

Well, yes, it has an effect if $abcdef is already an array (as in your
new example).  It has no effect if $abcdef is unset (as in your
original example) or is a scalar.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-15  6:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 17:09 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" ) Sebastian Gniazdowski
2017-06-14 20:35 ` Bart Schaefer
2017-06-15  6:03   ` Sebastian Gniazdowski
2017-06-15  6:10     ` Bart Schaefer

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).