The predicates in this section can help adapting your program to the
new convention for handling double quoted strings. We have adapted a
huge code base with which we were not familiar in about half a day.
- list_strings
- This predicate may be used to assess compatibility issues due to the
representation of double quoted text as string objects. See
section 5.2 and section
5.2.3. To use it, load your program into Prolog and run list_strings/0.
The predicate lists source locations of string objects encountered in
the program that are not considered safe. Such string need to be
examined manually, after which one of the actions below may be
appropriate:
- check:string_predicate(:PredicateIndicator)
- Declare that PredicateIndicator has clauses that contain
strings, but that this is safe. For example, if there is a predicate
help_info/2 , where the second argument contains a double quoted string
that is handled properly by the predicates of the applications’help
system, add the following declaration to stop
list_strings/0
from complaining:
:- multifile check:string_predicate/1.
check:string_predicate(user:help_info/2).
- check:valid_string_goal(:Goal)
- Declare that calls to Goal are safe. The module qualification
is the actual module in which Goal is defined. For example, a
call to format/3
is resolved by the predicate system:format/3.
and the code below specifies that the second argument may be a string
(system predicates that accept strings are defined in the library).
:- multifile check:valid_string_goal/1.
check:valid_string_goal(system:format(_,S,_)) :- string(S).