Hi!

----

The following example...
-- snip --
namespace ghatanothoa
{
        typeset -T addme_t=(
                compound c=(
                        compound -a ar
                )

                function addsomething
                {
                        nameref container=_.c
                        nameref arr=container.ar
                        
                        # fill local variable with data...
                        compound nelement=( value="$1" value2="$2" )

                        # ... once done move it into the array
                        typeset -m "arr[${#arr[@]}]=nelement"
                }
        )
}

function main
{
        .ghatanothoa.addme_t ad

        ad.addsomething "fish" "in water"
        ad.addsomething "chicken" "on land"

        print "${ad}"
}

set -o nounset
main
-- snip --
... should AFAIK print...
-- snip --
(
        c=(
                typeset -a ar=(
                        [0]=(
                                value=fish
                                value2='in water'
                        )
                        [1]=(
                                value=chicken
                                value2='on land'
                        )
                )
        )
)
-- snip --
... but ast-ksh.2012-08-13 (ksh93v-) prints this:
-- snip --
$ ~/bin/ksh x.sh
x.sh[33]: main[26]: ad.addsomething[17]: typeset: ad.c.ar[0]: no parent
x.sh[33]: main[27]: ad.addsomething[17]: typeset: ad.c.ar[1]: no parent
(
        c=(
                typeset -a ar
                typeset -a ar
        )
)
-- snip --
(note that the "-C" attribute from "ar" is gone, too) ...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.ma...@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to