Closed
Description
global
does not always refer to the global scope.
In [1]: for i = 1:1
...: local z = 1
...: for i = 1:1
...: global z = 1
...: end
...: end
In [2]: z
z not defined
at In[2]:1
Another example:
In [17]: function foo(z)
...: global z = 2
...: end
Out[17]: foo (generic function with 1 method)
In [18]: foo(3)
Out[18]: 2
In [19]: z
z not defined
at In[19]:1
Version information:
In [3]: versioninfo()
Julia Version 0.2.0
Commit 05c6461 (2013-11-16 23:44 UTC)
Platform Info:
System: Windows (x86_64-w64-mingw32)
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
LAPACK: libopenblas
LIBM: libopenlibm
Note: I believe this same behavior occurs on the latest snapshot.