Discussion:
[ast-developers] Why do compound structs not work in ksh types?
Cedric Blancher
2017-02-03 10:35:04 UTC
Permalink
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 <***@gmail.com>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur
Danny Weldon
2017-02-05 12:48:46 UTC
Permalink
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.
Post by Cedric Blancher
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
--
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur
_______________________________________________
ast-users mailing list
http://lists.research.att.com/mailman/listinfo/ast-users
--
Regards

Danny
Loading...