Modes used in the Commons Library

Author(s): Manuel Hermenegildo, Jose F. Morales.

This file contains the modes proposed for the commons library. They are similar to the ones used in the ISO standard and in recent proposals.

Usage and interface

  • Library usage:
    :- use_package(commons_modes). or :- module(...,...,[commons_modes]).
  • New operators defined:
    ?/1 [200,fy], @/1 [200,fy], :/1 [200,fy].
  • New modes defined:
    +/1, -/1, ?/1, @/1, :/1, +/2, -/2, ?/2, @/2, :/2.

Documentation on new modes

MODE

(True) Usage:+A

The classic way to mark an input argument.

  • The following properties are added at call time:
    (nonvar/1)A is currently a term which is not a free variable.

MODE

(True) Usage:-A

The classic way to mark an output argument.

  • The following properties are added at call time:
    (var/1)A is a free variable.

MODE

MODE

(True) Usage:@A

  • The following properties are added globally:
    (not_further_inst/2)A is not further instantiated.

MODE

(True) Usage::(A)

Is a meta-argument (implies +)

  • The following properties are added at call time:
    (nonvar/1)A is currently a term which is not a free variable.

MODE

(True) Usage:A+X

  • The following properties are added at call time:
    (call/2)Argument A has property X (e.g., int(A)).

MODE

(True) Usage:A-X

  • The following properties are added at call time:
    (var/1)A is a free variable.
  • The following properties are added upon exit:
    (call/2)Argument A has property X (e.g., int(A)).

MODE

(True) Usage:A?X

  • Call and exit are compatible with:
    (call/2)Argument A has property X (e.g., int(A)).
  • The following properties are added upon exit:
    (call/2)Argument A has property X (e.g., int(A)).

MODE

(True) Usage:@(A,X)

  • The following properties are added at call time:
    (call/2)Argument A has property X (e.g., int(A)).
  • The following properties are added upon exit:
    (call/2)Argument A has property X (e.g., int(A)).
  • The following properties are added globally:
    (not_further_inst/2)A is not further instantiated.

MODE

(True) Usage:A:X

Is a meta-argument (implies +)

  • The following properties are added at call time:
    (call/2)Argument A has property X (e.g., int(A)).

Known bugs and planned improvements

  • Need to add ref to Jan et al's paper, etc.