This has been discussed in https://groups.google.com/forum/#!searchin/julia-users/typecheck/julia-users/hTQ2KI1aaTc/fqjq-1n_ax8J
PS. it was much easier to find when I knew that it was there. Ivar kl. 09:15:20 UTC+1 torsdag 13. mars 2014 skrev Carlos Becker følgende: > > Hello, > > When writing functions, it can happen that one can accidentally refer to a > global variable 'by mistake', for example > > function test( x1, y1 ) > return x2 + y1 # typo, x2 instead of x1, tries to locate global var x2 > end > > so if x2 exists as a global variable, the typo will go unnoticed and the > bug may be very hard to spot. > > I have two questions: > 1) is there a way to search for possible global variables in a function? > This would be a great sanity check tool. > 2) wouldn't it be desirable to have a modifier to force global variables > to have the 'global' prefix? > like @explicitglobals function test(x1,x2) ... > > (I found a previous discussion about pure functions, but I think this is > more specific to global/local variables) > > Thanks. >
