There is a way to construct variables that can be used within a given source file, and are invisible to code placed in other files. We use
:= for this. Assume the code below is placed in a file, and that the file is loaded with the
load command.
i1 : ff := 5
o1 = 5
|
i2 : ff
o2 = 5
|
The variable above is a local one. Its value is not available to code in other files.
Assume the code above is entered directly by the user into Macaulay2. Then the variable is still a local one and is not available to code previously loaded or to functions previously defined, but it will be available to code loaded subsequently. We illustrate this below with the variable
j.
i3 : j
o3 = j
o3 : Symbol
|
i4 : h = () -> j
o4 = h
o4 : FunctionClosure
|
i5 : h()
o5 = j
o5 : Symbol
|
i6 : j = 444
o6 = 444
|
i7 : h()
o7 = 444
|
i8 : j := 555
o8 = 555
|
i9 : h()
o9 = 444
|
i10 : j
o10 = 555
|