Hi,

When I increment an uninitialized element of an indexed or associative array
from within an arithmetic context, there is no effect in the latest alpha. It
worked in ksh93u. It applies only to arithmetic assignments, but incrementing
via simple assignment works fine.

Can anyone reproduce this regression?

         $ ksh -c 'print -v .sh.version'
         Version AIJM 93v- 2014-05-09

         # Increment from math context broken.
         $ ksh -c 'integer i; integer -a arr; ((i++, arr[3]++)); typeset -p arr 
i'
        typeset -a -l -i arr=()
        typeset -l -i i=1

         # Simple assignments are fine.
         $ ksh -c 'integer i; integer -a arr; i+=1 arr[3]+=1; typeset -p arr i'
        typeset -a -l -i arr=([3]=1)
        typeset -l -i i=1

         # Compound assignments also fine.
         $ ksh -c 'integer -a arr; arr+=([3]+=1); typeset -p arr'
        typeset -a -l -i arr=([3]=1)

         # First example in mksh/zsh.
         $ mksh -c 'integer i; integer -a arr; ((i++, arr[3]++)); typeset -p 
arr i'
        set -A arr
        typeset -i arr[3]=1
        typeset -i i=1

         $ zsh -c 'integer i; integer -a arr; ((i++, arr[3]++)); typeset -p arr 
i'
        zsh:1: bad option: -a
        typeset -a arr
        arr=('' '' 1)
        typeset -i i=1

-- 
Dan Douglas
_______________________________________________
ast-developers mailing list
ast-developers@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to