I find this to be a problem when creating black box functions that are totaly isolated from the rest of the script, so people can not see or change internal data by accident.
Example:
#SingleInstance, force
!p::
ToggleMenu( WinExist("A") )
return
ToggleMenu( hWin )
{
static hMenu, visible
if hMenu =
hMenu := DllCall("GetMenu", "uint", hWin)
if !visible
DllCall("SetMenu", "uint", hWin, "uint", hMenu)
else DllCall("SetMenu", "uint", hWin, "uint", 0)
visible := !visible
}This function will toggle menu of window on/off.
It works for one window only since window's menu is stored in static variable hMenu on first function usage.
If I want to change this so it works for all windows, it must remember handles of eatch window menu in array. Using global arrays is not good idea since those can be accessed and changed by accident.
Local static array would be much more convenient here - it will allow totaly function isolation no matter what is its environment.
LIke I once mentioned, it can be achieved with some metachar, like
static array*
Some meta like this one will also allow for local and global and static arrays at the same time:
global
static sArray*
local localArray*
The meaning of metachar * is that all variables starting with given prefix are to be considered static/local.




