Skip to content

Latest commit

 

History

History
82 lines (56 loc) · 2.14 KB

public_1.rst

File metadata and controls

82 lines (56 loc) · 2.14 KB
.. rst-class:: align-right

directive

.. index:: pair: public/1; Directive

public/1

Description

public(Name/Arity)
public((Name/Arity, ...))
public([Name/Arity, ...])

public(Name//Arity)
public((Name//Arity, ...))
public([Name//Arity, ...])

public(op(Precedence,Associativity,Operator))
public((op(Precedence,Associativity,Operator), ...))
public([op(Precedence,Associativity,Operator), ...])

Declares :term:`public <public predicate>` predicates, public grammar rule non-terminals, and public operators. A public predicate can be called from any object. A public non-terminal can be used as an argument in :ref:`methods_phrase_2` and :ref:`methods_phrase_3` calls from any object.

Note

Declaring a public operator does not make it global when the entity holding the scope directive is compiled and loaded. But declaring public operators provides a reusable specification for using them in the entity clients (e.g. in :ref:`directives_uses_2` directives).

Template and modes

public(+predicate_indicator_term)
public(+non_terminal_indicator_term)
public(+operator_declaration)

Examples

:- public(ancestor/1).

:- public((instance/1, instances/1)).

:- public([leaf/1, leaves/1]).
.. seealso::

   :ref:`directives_private_1`,
   :ref:`directives_protected_1`,
   :ref:`methods_predicate_property_2`