[m-rev.] for review: string.between
Mark Brown
mark at csse.unimelb.edu.au
Sat Jun 11 00:06:12 AEST 2011
Hi,
On 10-Jun-2011, Peter Wang <novalazy at gmail.com> 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.
I agree with reasons 1, 3 and 4. This is the right interface, IMO.
I haven't looked at the code; I assume it's straightforward.
Cheers,
Mark.
--------------------------------------------------------------------------
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