PLOGHELP NO_CLAUSES                         Robert Duncan, February 1988


    :- op(254, fx, no_clauses).

    ?- no_clauses PredicateSpec.


Declares that no textual record should be kept of the clauses used to
define the predicates identified by PredicateSpec. PredicateSpec must be
a conjunction of simple specifications of the form

    Fn/Arity

where Fn is an atom (the functor name of the predicate) and Arity an
integer (its arity). For example, the directive:

    :- no_clauses search/3, reduce/2.

declares that no text should be kept for the predicates search/3 and
reduce/2.

Not keeping the textual form of a predicate can save space, and may make
a significant contribution if repeated for many of the predicates in a
large program. It does mean however that built-in predicates which make
use of the textual form of clauses, such as listing/1 and clause/2, will
not work once the text has been discarded.

The "no_clauses" declaration is only effective for predicates which are
compiled in "static" mode, i.e. those which have not been declared
dynamic (see PLOGHELP * DYNAMIC). Dynamic predicates always keep their
textual form. You should never try to assert or retract on a predicate
which has no textual form, or try to augment its definition by
consulting: the clauses which comprised the original definition of the
predicate will be lost.


The default behaviour of the Prolog compiler is to keep the textual
form of clauses for all predicates unless indicated otherwise by the
"no_clauses" declaration. You can reverse this behaviour by means of the
directive:

    :- prolog_no_clauses(on).

after which no text will be kept for any (static) predicate unless
explicitly requested by the declaration

    :- clauses PredicateSpec.

This ensures that the specified predicates will keep their textual form
regardless of the compiler's current default behaviour. You can
reintroduce the standard behaviour by doing:

    :- prolog_no_clauses(off).


To discover whether a particular predicate has been declared as
"no_clauses", use the goal:

    ?- predicate_info(Fn/Arity, Info).

(see PLOGHELP * PREDICATE_INFO). For a given predicate Fn/Arity, the
list of declaration attributes bound to Info will include one or other
of the atoms 'no_clauses' or 'clauses' depending on how the predicate
has been declared. Thus:

    ?- predicate_info(write/1, Info).
    Info = [system_predicate, static, no_clauses] ?

because built-in system predicates have no textual form, whereas:

    ?- predicate_info(my_predicate/2, Info).
    Info = [user_predicate, static, clauses] ?


-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * DYNAMIC, * SYSTEM_PREDICATE
    Describe other declaration forms.

PLOGHELP * EFFICIENCY
    Hints on making Prolog programs more efficient.

PLOGHELP * PREDICATE_INFO
    Gives information about how a predicate has been declared.

PLOGHELP * SYSTEM
    Describes those predicates which affect how the Prolog system
    behaves.

--- C.all/plog/help/no_clauses -----------------------------------------
--- Copyright University of Sussex 1988. All rights reserved. ----------
