[ Modules | Reference Manual | Alphabetic Index ]

# tool_body(++PredSpecI, -PredSpecB, -Module)

Succeeds if PredSpecI is a tool interface procedure, PredSpecB is its body procedure, and Module the module where it is defined.

PredSpecI
  Expression of the form Atom/Integer.
PredSpecB
  Expression of the form Atom/Integer.
Module
  Atom or variable.

## Description

To a given tool interface procedure it finds the corresponding body procedure and the module where it is defined.

### Modes and Determinism

- tool_body(++, -, -) is det

### Modules

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

### Exceptions

(4) instantiation fault
  PredSpecI is not instantiated.
(5) type error
  Either PredSpecI or PredSpecB is instantiated, but not to the form Atom/Integer.
(91) not a tool procedure
  PredSpecI is not a tool interface procedure.

## Examples

    Success:
          [eclipse]: tool_body(write/1, P, M), (import P from M).
          P = write_ / 2             % find the body
          M = sepia_kernel           %   procedure and
          yes.                       %   import it

    Fail:
          tool_body(write/1, true/0, M).

    Error:
          tool_body(L, P, M).                   (Error 4).
          tool_body("current_functor/1", P, M). (Error 5).
          tool_body(current_functor/1, P, M).   (Error 91).

## See Also

tool / 2