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

[bug] Math evaluation done twice in subscript in specific conditions



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