Module notation

For debugging purpose it might be necessary to have direct access to our Prolog module notation. Our Prolog module notations are ordinary Prolog terms that are converted to inter-preter objects. The slash notation combines a package name and a module name into a structured module name. The colon notation separates combines module name and a predicate name into a qualified predicate name.

Examples:
?- sys_atom_slash(X, foo/bar).
X = 'user$foo$bar'
?- sys_atom_slash(X, basic/lists).
X = 'jekpro.frequent.basic.lists'

The predicate sys_atom_slash/2 can be used to explicitly invoke the slash (/)/2 compound notation conversion, yielding a period (.) respectively dollar ($) characters in the resulting atom. The notation can be used to denote Prolog text modules and Java Classes. We additionally support for the {}/1 compound notation conversion as well, which can be used to denote Java Array Classes and yielding ([]) characters.

Examples:
?- sys_callable_colon(X, basic/lists:member(A,B)).
X = 'jekpro.frequent.basic.lists\bmember'(A,B)
?- sys_indicator_colon(X, basic/lists:member/2).
X = 'jekpro.frequent.basic.lists\bmember'/2

The predicates sys_callable_colon/2 can be used to explicitly invoke the colon (:)/2 and double colon (::)/2 notation conversion for a callable. The double colon notation combines the receiver module name by additionally prepending the receiver itself to the callable similar to the Python dynamic invocation. The predicate sys_indicator_colon/2 can be used to explicitly invoke to colon notation conversion for a predicate indicator.

The following base predicates are provided:

sys_atom_slash(S, T):
The predicate succeeds when S is a callable of the form ‘s1. .. .sn’ and T is a slash no-tation atom of the form s1/../sn, for 1 ≤ n. Besides the (/)/2 operator the {}/1 operator is supported as well.
sys_callable_colon(S, T):
The predicate succeeds when S is a callable of the form ‘pk-1%pk’(X1, .., Xm) and T is a colon notation callable of the form p1:..:pk(X1, .., Xm), for 1 ≤ k and 0 ≤ m.
sys_indicator_colon(S, T):
The predicate succeeds when S is an indicator of the form ‘pk-1%pk’/m and T is a colon notation indicator of the form p1:..:pk/m, for 1 ≤ k and 0 ≤ m.

The following source properties for the module base are provided:

sys_first_location(I, O, L):
The property indicates that the source context has first predicates occurence for the indicator I, file origin O and line number L. The property is multi valued or can be missing. The property cannot directly be changed.
sys_location(I, O, L):
Same as sys_first_location/3 except that not only the first occurrence for each predicate is listed but that all occurences are listed.

Kommentare