This script core dumps:

------------------------------------------------------------
set -vx

typeset -T A_t=(
    typeset name="aha"
)

typeset -T B_t=(
    typeset -a  arr
    A_t         a

    create()
    {
        A_t a1=(name="one")
        A_t a2=(name="two")

        _.arr[0]=$a1
        _.arr[1]=$a2
    }

    f()
    {
        eval "_.a=${_.arr[0]}"
        print "arr[0] = ${_.a}"
    }
)

B_t b
b.f
------------------------------------------------------------

It doesn't crash if the line
        
        eval "_.a=${_.arr[0]}"

is replaced by

        _.a=${_.arr[0]}

but the output is then

        arr[0] = (
                name=aha
        )

whereas of course I want to get 'name=one'.
Hm, is storing typed values in an untyped array possible at all, and which would be the correct way (the eval version, I presume)?

Regards,
Bernd


--
Bernd Eggink
http://sudrala.de
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to