# `use_module/1`

## Description

    use_module([Module as Alias, ...])

Declares module aliases. Typically used to shorten long module names and to simplify using or experimenting with different module implementations of the same predicates when using explicitly-qualified calls. Module aliases are local to the object (or category) where they are defined.

The modules being aliased can be parameter variables when using the directive in a parametric object or a parametric category defined in a source file (the common case).

Declaring multiple aliases for the same module is allowed. But repeated declarations of the same alias, declaring an alias for a module alias, and redefining an alias to reference a different module are reported as compilation errors.

To enable the use of static binding, and thus optimal predicate call performance, the modules should be loaded before compiling the entities that call their predicates.

Note that this directive semantics differs from the directive with the same name found on some Prolog implementations where it is used to load a module and import all its exported predicates.

## Template and modes

    use_module(+module_alias_list)

## Examples

    :- object(foo(_DataModule_)).

        :- use_module([
            _DataModule_ as data
        ]).

        bar :-
            ...,
            % the same as _DataModule_:xy(X, Y)
            data:xy(X, Y),
            ...

See also

uses/1, uses/2, use_module/2