Use library functions by a short name
This functionality does not run in MATLAB.
use(L, <Alias>, f1, f2, …) use(L, <Alias>)
use(L, f) 'exports' the public function L::f of the library L to the global namespace such that it can be accessed as f without the prefix L.
use(L) exports all public functions of the library L.
A library contains public functions which may be called by the user. The collection of these functions forms the interface of the library. (There may be other, private, functions, too, which are not intended to be called by the user directly, and are not documented.) The standard way of accessing the public function f from the library L is via L::f. When the function f is exported, it can be accessed more briefly as f. Technically, exporting means that the global identifier f is assigned the value L::f. Alternatively, when the option Alias is used, an alias is created.
Unexporting the library function f means that the value of the global identifier f is deleted. Afterwards, the library function is available only as L::f.
use(L, f1, f2, ...) exports the given functions f1, f2, ... of L. However, if one of the identifiers already has a value, the corresponding function is not exported. A warning is printed instead. An error is returned if one of the identifiers is not the name of a public library function.
use(L) exports all public functions of L.
A function that is already exported will not be exported twice.
use evaluates its first argument L, but it does not evaluate the remaining arguments f1, f2, ..., if any.
The function info displays the interface functions and the exported functions of a library.
Some libraries have functions that are always exported. These functions cannot be unexported. The function append from the library listlib is such an example.
When a function is exported, it is assigned to the corresponding global identifier. When it is unexported, the corresponding identifier is deleted.
Export the function invphi of the library numlib, and then undo the export:
Export all functions of the library numlib:
Warning: Identifier 'divisors' already has a value. It is not exported. [use]
Warning: Identifier 'contfrac' already has a value. It is not exported. [use]
Here, use issues warnings because contfrac and divisors are already available as global functions. For example, there is the global contfrac function that uses numlib::contfrac for numerical arguments. Undo the export of the numlib functions.
use issues a warning if a function cannot be exported since the corresponding identifier already has a value:
invphi := 17: use(numlib, invphi)
Warning: Identifier 'invphi' already has a value. It is not exported. [use]
Use alias(f = L::f) to create an alias f for L::f rather than exporting L::f by the assignment f:= L::f.
Void object null() of type DOM_NULL.
The names of the public functions of a library L are stored in the set L::interface. This set is used by the function info and for exporting.
The names of functions exported from a library L are stored in the set L::_exported.