Hi!

----

The following example...
-- snip --
$ ksh -c 'typeset -a ar=( 2 3 4 ) ; function fn { nameref n=$1 ; print
-- "$n" ; } ; function main { integer i ; for ((i=0 ; i < ${#ar[@]} ;
)) ; do fn ar[i++]  ; done ; } ; main ; true'
-- snip --
... should AFAIK print...
--- snip --
2
3
4
-- snip --
... but ast-ksh.2013-05-24 runs in an endless loop (warning (mostly
for myself): Any test module should have a 2nd integer aborting the
endless loop) printing newlines...

The workaround is to replace the ar[i++] with ar[$((i++))], e.g. ...
-- snip --
$ ksh -c 'typeset -a ar=( 2 3 4 ) ; function fn { nameref n=$1 ; print
-- "$n" ; } ; function main { integer i ; for ((i=0 ; i < ${#ar[@]} ;
)) ; do fn ar[$((i++))]  ; done ; } ; main ; true'
2
3
4
-- snip --
... so that the nameref only gets a "static" string as index... the
only issue is that this requires an internal integer-to-string
conversion which is IMO unneccesary...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to