use

To use a module, use the “use” keyword followed by the module names.

$ use example::ch9

After this, we can call all the functions defined in the module. Since different modules can define functions with the same name, the following are the rules to disambiguate function calls.

(1) Function names are qualified with the module namespace.

  • Simply refer to the function defined in that module.

  • All DolphinDB built-in functions are defined in the root module ::. For example, ::add(3,4) means the add function in the root module.

(2) Namespace is not specified.

  • If the current module defines the function, it refers to the function defined in the current module.

  • If one and only one imported module contains the function, it refers to the function defined in that module.

  • If two or more imported modules contain the function, throw an exception.

  • If no imported module contains the function, search in the root namespace. If the root namespace does not contain the function, throw an exception.

Related statement: module