[m-rev.] for review: Fix some handling of ill-formed sequences in string module.
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Jul 27 12:32:40 AEST 2022
2022-07-27 11:34 GMT+10:00 "Peter Wang" <novalazy at gmail.com>:
>> > Fix the Mercury implementation of string.contains_char to continue
>> > searching for the character past any ill-formed code unit sequences.
>>
>> Do we even need the Mercury implementation since there are foreign_proc
>> implementations for all three target languages?
>>
>
> Not really, but we have them for other predicates as well.
Were those left over from when they were the definition in Erlang grades?
> ### Changes to the `string` module
>
> +* We have fixed the behaviour of the following predicates when called on a
> + string containing ill-formed code unit sequences:
> +
> + - pred `all_match/2`
> + - pred `index_next_repl/5`
> + - pred `unsafe_index_next_repl/5`
> + - pred `prev_index_repl/5`
> + - pred `unsafe_prev_index_repl/5`
I would s/fixed/clarified/.
> --- a/library/string.m
> +++ b/library/string.m
> @@ -576,14 +576,15 @@
> % all_match(TestPred, String):
> %
> % True iff String is empty or contains only code points that satisfy
> - % TestPred.
> + % TestPred. False if String contains an ill-formed code unit sequence.
> %
That doesn't work, because the second sentence adds a condition for False
that the "iff" in the first sentence rules out. How about
True iff all code points in String satisfy Pred, and String contains no ill-formed
code unit sequences.
The other two comment changes are fine.
The NEWS update mentions two other predicates: why no update
to them?
Zoltan.
More information about the reviews
mailing list