Predicate Visibility

Classification
Enhancement

Discrepancy

The ISO standard requires that the built-in current_predicate/1 finds all predicates, static or dynamic, with or without clauses that were defined by the user. Such a predicate might have some applications in a listing/0 predi-cate that should only show the user defined clauses.

In our implementation the built-in is capable of enumerating and checking all possibly qualified predicates that are visible from the call-site. This allows for example checking the existence and accessibility of a predicate before it is called, accessed or modified.

In our implementation the visibility of a predicate depends on its reachability via import and export and on its visibility attributes. Non-qualified predicates are visible everywhere. In as far there is no difference between user and non-user defined predicates.

Integration / Elimination

The ISO module standard defines a predicate current_visible/1. The intention of our built-in current_predicate/1 is to function similarly to this predicate. The predicate cannot enumerate private predicates or package local predicates when the call-site is a different package.

For an unrestricted enumeration and checking we provide a module in the development environment. The module is inspection/provable and the predicate current_provable/1 does the job.

Failed Test Cases

ISO 8.8.2.4, ISO 2

Related Findings

Comments