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.

Reply via email to