[m-rev.] for review: Deprecate multi modes of string.prefix and string.suffix.

Peter Wang novalazy at gmail.com
Thu Oct 24 14:58:16 AEDT 2019


The two modes of string.prefix and string.suffix are not equivalent in
the presence of ill-formed code unit sequences. The solution is to
deprecate the lesser used mode of each.

library/string.m:
    As above.

    Delete outdated comments.
---
 library/string.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/library/string.m b/library/string.m
index 99b272fb7..214bd4a1f 100644
--- a/library/string.m
+++ b/library/string.m
@@ -871,6 +871,7 @@
     % prefix(String, Prefix) is true iff Prefix is a prefix of String.
     % Same as append(Prefix, _, String).
     %
+%:- pragma obsolete_proc(prefix(in, out)).
 :- pred prefix(string, string).
 :- mode prefix(in, in) is semidet.
 :- mode prefix(in, out) is multi.
@@ -878,6 +879,7 @@
     % suffix(String, Suffix) is true iff Suffix is a suffix of String.
     % Same as append(_, Suffix, String).
     %
+%:- pragma obsolete_proc(suffix(in, out)).
 :- pred suffix(string, string).
 :- mode suffix(in, in) is semidet.
 :- mode suffix(in, out) is multi.
@@ -4496,7 +4498,6 @@ prefix_2_ioi(String, Prefix, Cur) :-
     (
         Prefix = unsafe_between(String, 0, Cur)
     ;
-        % XXX ILSEQ unsafe_index_next stops at ill-formed sequence
         unsafe_index_next(String, Cur, Next, _),
         prefix_2_ioi(String, Prefix, Next)
     ).
@@ -4518,7 +4519,6 @@ suffix_2_ioii(String, Suffix, Cur, Len) :-
     (
         unsafe_between(String, Cur, Len, Suffix)
     ;
-        % XXX ILSEQ unsafe_prev_index stops at ill-formed sequence
         unsafe_prev_index(String, Cur, Prev, _),
         suffix_2_ioii(String, Suffix, Prev, Len)
     ).
-- 
2.23.0



More information about the reviews mailing list