David, can you explain why this test case prints a
mybot.join_channels[0]: parameter not set error with an IMO valid
statement to access an indexed array type member?
==================================
typeset -T ircsession_t=(
typeset -a join_channels
function createsession
{
nameref jc="$1"
integer i
for (( i=0 ; i < ${#jc[@]} ; i++ )) ; do
_.join_channels+=( "${jc[i]}" )
done
return 0
}
function mainloop_tick
{
return 0
}
function join_channel
{
return 0
}
)
set -o nounset
set -o noglob
typeset -a join_channels
ircsession_t mybot=(
function mainloop_tick
{
integer i
if true ; then
# BUG: this will generate the error:
# mybot.join_channels[0]: parameter not set
for (( i=0 ; i < ${#_.join_channels[@]} ; i++ )) ; do
_.join_channel "${_.join_channels[i]}"
done
else
typeset c
for c in "${_.join_channels[@]}" ; do
_.join_channel "${c}"
done
fi
return 0
}
)
# OpenSolaris channels
join_channels+=( '#opensolaris' )
join_channels+=( '#opensolaris-dev' )
join_channels+=( '#opensolaris-arc' )
join_channels+=( '#opensolaris-meeting' )
print $"## Start."
mybot.createsession join_channels
mybot.mainloop_tick
print $"## End."
==================================
Olga
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ [email protected] \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users