Discussion:
[ast-developers] Copy var (typeset -c) does not work in a type
Lionel Cons
2014-09-03 18:25:09 UTC
Permalink
Version ABIJM 93v- 2014-07-21, we can't use typeset -c to copy an
array into a type:

ksh -c 'typeset -T x_t=( typeset -a ar ; function grab { typeset -c
_.ar=$1 ; } ; ) ; function foo { nameref c=$1 ; x_t c.i ; nameref
i=c.i ; typeset -a c.a1=( 1 2 3) ; i.grab c.a1 ;} ; compound cv ; foo
cv ; print -v cv'
(
typeset -a a1=(
1
2
3
)
x_t i=(
typeset -C -a ar
)
)

It should print:
(
typeset -a a1=(
1
2
3
)
x_t i=(
typeset -a ar=(
1
2
3
)
)
)

Changing the type of function from function foo to foo() is a
workaround, but for the final production script we need local
variables.

Lionel
Lionel Cons
2014-09-09 21:12:14 UTC
Permalink
Post by Lionel Cons
Version ABIJM 93v- 2014-07-21, we can't use typeset -c to copy an
ksh -c 'typeset -T x_t=( typeset -a ar ; function grab { typeset -c
_.ar=$1 ; } ; ) ; function foo { nameref c=$1 ; x_t c.i ; nameref
i=c.i ; typeset -a c.a1=( 1 2 3) ; i.grab c.a1 ;} ; compound cv ; foo
cv ; print -v cv'
(
typeset -a a1=(
1
2
3
)
x_t i=(
typeset -C -a ar
)
)
(
typeset -a a1=(
1
2
3
)
x_t i=(
typeset -a ar=(
1
2
3
)
)
)
Changing the type of function from function foo to foo() is a
workaround, but for the final production script we need local
variables.
Lionel
David, do you have any fix for this bug?

Lionel

Loading...