Indicate whether a variable or function defined.
Integer_Type is_defined (String_Type obj)
This function is used to determine whether or not a function or
variable whose name is obj
has been defined. If obj
is not
defined, the function returns 0. Otherwise, it returns a non-zero
value that defpends on the type of object obj
represents.
Specifically, it returns one of the following values:
+1 if an intrinsic function
+2 if user defined function
-1 if intrinsic variable
-2 if user defined variable
0 if undefined
For example, consider the function:
define runhooks (hook)
{
if (2 == is_defined(hook)) eval(hook);
}
This function could be called from another S-lang function to
allow customization of that function, e.g., if the function
represents a mode, the hook could be called to setup keybindings
for the mode.
typeof, eval, autoload