[m-rev.] for review: string.between
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu Jun 16 17:00:46 AEST 2011
On Fri, 10 Jun 2011, Peter Wang wrote:
> Branches: main
>
> Deprecate string.substring, string.foldl_substring, etc. in favour of
> new procedures named string.between, string.foldl_between, etc.
> The "between" procedures take a pair of [Start, End) endpoints instead
> of Start, Count arguments. The reasons for this change are:
>
> - the "between" procedures are more convenient
>
> - "between" should be unambiguous. You can guess that it takes an End
> argument instead of a Count argument without looking up the manual.
>
> - Count arguments necessarily counted code units, but when working with
> non-ASCII strings, almost the only way that the values would be arrived at
> is by substracting one end point from another.
>
> - it paves the way for a potential change to replace string offsets with an
> abstract type. We cannot do that if users regularly have to perform a
> subtraction between two offsets.
>
> library/string.m:
> Add string.foldl_between, string.foldl2_between,
> string.foldr_between, string.between.
>
> Deprecate the old substring names.
>
> Replace string.substring_by_codepoint by string.between_codepoints.
...
> tests/hard_coded/string_substring.m:
> Test both between and substring procedures.
This last test is now failing on goliath (Linux/x86_64).
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list