SPL files may contain one or more static functions. A static function is private to the SPL source file in which it is defined. Only functions within the same SPL file can call that static function.
// myfun.spl
static statfun()
{
return("myfun statfun");
}
myfun(x)
{
local y;
y = statfun();
return(y);
}
// statfun.spl
statfun()
{
return("statfun);
}
a = statfun();
b = myfun();
a == "statfun"
b == "myfun statfun"
The
function statfun defined in statfun.spl
is a standard global function. The function statfun defined
in myfun.spl is static and therefore hidden from all
functions outside myfun.spl. Within myfun.spl, the static
definition takes precedence over any global function of the same name.
A static function should appear before any global or static function in the same SPL file that calls it.