next up previous index
Next: Input and Output Up: Arrays and Global Previous: Global References

Visibility

All the examples so far created objects with unlimited visibility, i.e. they can be accessed, modified and even erased from every module. Yet the scope of an array or global variable can also be restricted to a single module. Such an object is created by using make_local_array/1,2.

Note that to obtain a global variable with restricted scope, it must also be explicitly declared using make_local_array/1, since otherwise setval/2 implicitly creates one with unrestricted scope.

The visibility rule is such that an object declared local to a module hides an unrestricted one with the same name and number of dimensions. Destroying a local array or variable with erase_array/1 may therefore uncover an existing global one. All built-ins that have been discussed in this chapter access the visible array or variable.



Micha Meier
Mon Mar 4 12:11:45 MET 1996