about the only major thing i see missing in hush after testing on random 
packages out there is the "local" keyword.

x=1
f() { local x=$((x + 3)) ; echo $x ; }
g() { local x=$((x + 1)) ; f ; echo $x ; }
g
echo $x

the keyword causes the variable to only apply to children of the active 
function scope.  so here, we should see:
5 - global 1 added to g()'s 1 added to f()'s 3
2 - global 1 added to g()'s 1 unaffected by f()
1 - global 1 unaffected by g() or f()

another example:
x=1
f() { x=2; }
g() { local x=3; f; echo $x; }
g
we see the x is declared local to g()'s scope, and f() modifies it since it is 
called inside that scope.

based on these needs, i'm thinking:
 - new variable state for set_local_var()
 - when a variable is marked local and it shadows an existing variable, we 
insert it into the linked list of variables before the existing copy
 - at the end of run_and_free_list(), we walk the variable list destroying all 
variables marked local
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to