
lock_pass(+)

   Locks access to internals of the current module

Type
   Modules

Description
    Used to forbid access from outside the current module to its internals,
    except through the module interface (i.e. its exports).

    This primitive is usually used a directive in the source code of the
    module to be locked.

    A module locked with lock_pass/1 can be unlocked using unlock/2, and
    giving the same pass-string that was used in locking.  The pass-string
    can be changed by calling lock_pass/1 again from within the module.



Modes and Determinism
   lock_pass(+) is det

Modules
   This predicate is sensitive to its module context (tool predicate, see @/2).

Examples
   
    % After compiling the following code:
     :- module(m).
     :- export pub/0.
     pub :- writeln(pub).
     priv :- writeln(priv).
     :- lock_pass("secret").


    ?- module(m).
    trying to access a locked module in module(m)

    ?- call(pub) @ m.
    pub
    yes.

    ?- call(priv) @ m.
    trying to access a locked module in priv

    ?- assert(foo) @ m.
    trying to access a locked module in assert_(foo, m)

    ?- unlock(m, "secret").
    yes.

    ?- call(priv) @ m.
    priv
    yes.

    ?- assert(foo) @ m.
    yes.



See Also
   lock / 0, unlock / 2, get_module_info / 3
