Discussion:
[ast-developers] How to define a local type variable?
Wendy Lin
2014-04-05 00:15:23 UTC
Permalink
How do I define a local type variable in a function?

If I do a typeset -T a_t=() and then do a function foo {, how do I
make the variable local?

Wendy
Danny Weldon
2014-04-06 08:12:59 UTC
Permalink
It appears to be local to me automatically, if this is
what you intended:

typeset -T A_t=(
typeset name
)

function foo
{
A_t x=(name=joe)

print foo_name=${x.name}
}

foo

print name=${x.name}

Output:
foo_name=joe
name=

Regards

Danny
David Korn
2014-04-06 21:45:45 UTC
Permalink
There is a bug which doesn't allow type names that begin with the letter
'a'. I have a fix for it.
Post by Danny Weldon
It appears to be local to me automatically, if this is
typeset -T A_t=(
typeset name
)
function foo
{
A_t x=(name=joe)
print foo_name=${x.name}
}
foo
print name=${x.name}
foo_name=joe
name=
Regards
Danny
_______________________________________________
ast-developers mailing list
ast-developers at lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.research.att.com/pipermail/ast-developers/attachments/20140406/da4d54cd/attachment.html>
Continue reading on narkive:
Loading...