Passing data structures to Icon procedures |
|
Suppose you pass some Icon variable named ``foo'' to a procedure, and then that procedure stores a value in that variable, and then returns control to you. Is your copy of ``foo'' the old value, or the one that the procedure put there?
The answer depends on the type of ``foo''. Types in Icon are divided into atomic types and aggregate type:
If you pass an aggregate to a procedure, any changes that the procedure makes to part of an aggregate affect your copy too. For example, if you pass a list to a procedure and that procedure stores a new first element in it, that will be reflected in your copy.