Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[bug] Math evaluation done twice in subscript in specific conditions
- X-seq: zsh-workers 44567
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [bug] Math evaluation done twice in subscript in specific conditions
- Date: Wed, 24 Jul 2019 01:50:23 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=+NGSQ6yhx7AMI1a619xmLAZeebdf6D0b3WvODDGMMtc=; b=I0K3JcAWwA+cHY0JBvV18dwhyVYfS/jS4gO6knxeNVwW9O2/Dpz68S0iKBC4IuwRAF eNkA0xrUH1h2XuBr4UajypHWdkWoj2l1+gTxUKmHp6UQK3/Gg0t6boFeH9XlCZRNE4xG b+LKpI2FDoeTax3o2B2tCb2Rd0ewJN/JJB2ROMZ7ZFFDAtkYyxULB+Mu2HrJ0i2Bhgfo DFp5MQv2ZBLttBc89B3aFDtR9mYIxm5mjPQ3Lsx750uaApaz2xXR6MG01XZTLL/q7XVT ji3Xwz4bJENnwIAkmxcRxDLwATlSUZxf0n73xrVRLw++DyekfArYP6InZ6IptvDQ1z4U TRGg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hello
This is interesting:
idx=0
a=()
: ${a[++idx]::=$idx}
print -rl $a
-> 1
: ${a[++idx]::=$idx}
print -rl $a
-> 1
-> 3
idx=1
: ${a[++idx]::=$idx}
print -rl $a
-> 1
-> 2
-> 3
So apparently the assignment to idx does change something for the
following ::= "call" and makes it work correctly. The second and
following ::= calls cause $idx to increment twice.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author