[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ast-users
Subject:    Re: [ast-users] Why do compound structs not work in ksh types?
From:       Danny Weldon <danny.weldon () gmail ! com>
Date:       2017-02-05 12:48:46
Message-ID: CAJDkJnH1aMuzw3NqbhR=p+Q3Sj7NT-gnDhD=w6gpCdfjAzotqQ () mail ! gmail ! com
[Download RAW message or body]

I believe it's because nested is defined as an empty compound and you
are trying to access a member (z) which was not in the original
definition as it was empty.  So you could predefine the z member, but
it would be nice to be able to have the ability to insert dynamic
structured data like you are trying to do.  I do not know the best
practice OO way though to do this if it would be added as a feature.
You can always add elements to arrays though.

On 3 February 2017 at 20:35, Cedric Blancher <cedric.blancher@gmail.com> wrote:
> Why do compound structs not work in ksh types?
>
> typeset -T vm_t=(
>     compound nested
>     integer size
>     float f=0
> )
>
> compound container=(
>     vm_t -A foo=(
>         [f]=(
>             f=-inf
>             nested=( z=1 )
>             size=1
>         )
>     )
> )
>
> print -v container
>
>
> returns the error test.ksh[17]: print: nested.z: is not an element of
> container.foo[f]
>
> Ced
> --
> Cedric Blancher <cedric.blancher@gmail.com>
> [https://plus.google.com/u/0/+CedricBlancher/]
> Institute Pasteur
> _______________________________________________
> ast-users mailing list
> ast-users@lists.research.att.com
> http://lists.research.att.com/mailman/listinfo/ast-users



-- 
Regards

Danny
_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic