This module introduces a series of commands that provide access to information stored within the interpreter data structures. It's primary use is for MAL debugging.

MODULE inspect;

PATTERN inspect.equalType(X_0:any, X_1:any):bit;
COMMENT "Return true if both operands are of the same type";

COMMAND inspect.getAtomNames():bat[:str];
COMMENT "Collect a BAT with the atom names.";

COMMAND inspect.getAtomSizes():bat[:int];
COMMENT "Collect a BAT with the atom sizes.";

COMMAND inspect.getAtomSuper():bat[:str];
COMMENT "Collect a BAT with the atom names.";

PATTERN inspect.getComment(X_0:str, X_1:str):bat[:str];
COMMENT "Returns the function help information.";

PATTERN inspect.getDefinition(X_0:str, X_1:str):bat[:str];
COMMENT "Returns a string representation of a specific function.";

COMMAND inspect.getEnvironment() (X_0:bat[:str], X_1:bat[:str]);
COMMENT "Collect the environment variables.";

COMMAND inspect.getEnvironment(X_0:str):str;
COMMENT "Get the value of an environemnt variable";

PATTERN inspect.getExistence(X_0:str, X_1:str):bit;
COMMENT "Returns a boolean indicating existence of a definition of a specific function.";

PATTERN inspect.getFunction():bat[:str];
COMMENT "Obtain the function name.";

PATTERN inspect.getKind():bat[:str];
COMMENT "Obtain the instruction kind.";

PATTERN inspect.getModule():bat[:str];
COMMENT "Obtain the function name.";

PATTERN inspect.getSignature(X_0:str, X_1:str):bat[:str];
COMMENT "Returns the function signature(s).";

PATTERN inspect.getSignatures():bat[:str];
COMMENT "Obtain the function signatures.";

PATTERN inspect.getSize(X_0:str, X_1:str):lng;
COMMENT "Return the storage size for a function (in bytes).";

PATTERN inspect.getSize():lng;
COMMENT "Return the storage size for the current function (in bytes).";

PATTERN inspect.getSource(X_0:str, X_1:str):str;
COMMENT "Return the original input for a function.";

PATTERN inspect.getType(X_0:any_1):str;
COMMENT "Return the concrete type of a variable (expression).";

PATTERN inspect.optimizer_stats() (X_0:bat[:str], X_1:bat[:int], X_2:bat[:lng]);
COMMENT "Get optimizer use statistics, i.e. calls and total time";