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

Is ${#array} supposed to work with ksharrays?



Try these two functions in 4.0.1-pre-2:

right() {
  setopt noksharrays
  local -a array
  repeat 10 array[$#array+1]=x
  print -l $array
}

wrong() {
  setopt ksharrays
  local -a array
  repeat 10 array[${#array}]=x
  print -l $array
}

It appears that ${#array} always returns 1 when ksharrays is set.  Should it?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author