private
Define a private function block
private
defines a function who's scope is limited to that module or source file.
Privates cannot be called from one module to another (unless they're wrapped around a global function
) and nor can they be called from the interactive command line. The purpose of a private
is to reduce repeated code inside a module or source file without cluttering up the global namespace.
private: name { code-block }
# The following cannot be entered via the command line. You need to write
# it to a file and execute it from there.
private hw {
out "Hello, World!"
}
function tom {
hw
out "My name is Tom."
}
function dick {
hw
out "My name is Dick."
}
function harry {
hw
out "My name is Harry."
}
Private names can only include any characters apart from dollar ($
). This is to prevent functions from overwriting variables (see the order of preference below).
Because private functions are fixed to the source file that declares them, there isn't much point in undefining them. Thus at this point in time, it is not possible to do so.
There is an order of precedence for which commands are looked up:
test
and pipe
functions because they alter the behavior of the compileralias
. All aliases are globalfunction
. All functions are globalprivate
. Private's cannot be global and are scoped only to the module or source that defined them. For example, You cannot call a private function from the interactive command lineset
or let
@g
alias
: Create an alias for a commandexec
: Runs an executableexport
: Define an environmental variable and set it's valuefexec
: Execute a command or function, bypassing the usual order of precedence.function
: Define a function blockg
: Glob pattern matching for file system objects (eg *.txt)global
: Define a global variable and set it's valuelet
: Evaluate a mathematical function and assign to variablemethod
: Define a methods supported data-typesset
: Define a local variable and set it's valuesource
: Import murex code from another file of code blockThis site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Thu May 26 22:49:43 UTC 2022 against commit 59e27bb59e27bb1013043fc4a940cf9a2767c63f31dad2c.
Current version is 2.8.2100 which has been verified against 15889 tests cases.