built-in predicate

extends_protocol/2-3

Description

extends_protocol(Protocol, ParentProtocol)
extends_protocol(Protocol, ParentProtocol, Scope)

Enumerates, by backtracking, all pairs of protocols such that the first one extends the second. The relation scope is represented by the atoms public, protected, and private.

Modes and number of proofs

extends_protocol(?protocol_identifier, ?protocol_identifier) - zero_or_more
extends_protocol(?protocol_identifier, ?protocol_identifier, ?scope) - zero_or_more

Errors

Protocol is neither a variable nor a valid protocol identifier:
type_error(protocol_identifier, Protocol)
ParentProtocol is neither a variable nor a valid protocol identifier:
type_error(protocol_identifier, ParentProtocol)
Scope is neither a variable nor an atom:
type_error(atom, Scope)
Scope is an atom but an invalid entity scope:
domain_error(scope, Scope)

Examples

% enumerate the protocols extended by the listp protocol:
| ?- extends_protocol(listp, Protocol).

% enumerate protocols that privately extend the termp protocol:
| ?- extends_protocol(Protocol, termp, private).