[m-rev.] for review: string.between

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Jun 13 20:54:39 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.

I think that some of the above also belongs in the NEWS file.

> 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.
>
> compiler/elds_to_erlang.m:
> compiler/error_util.m:
> compiler/rbmm.live_variable_analysis.m:
> compiler/timestamp.m:
> extras/posix/samples/mdprof_cgid.m:
> library/bitmap.m:
> library/integer.m:
> library/lexer.m:
> library/parsing_utils.m:
> mdbcomp/trace_counts.m:
> profiler/demangle.m:
> 	Conform to changes.
>
> tests/general/Mercury.options:
> tests/general/string_foldl_substring.exp:
> tests/general/string_foldl_substring.m:
> tests/general/string_foldr_substring.exp:
> tests/general/string_foldr_substring.m:
> tests/hard_coded/Mercury.options:
> tests/hard_coded/string_substring.m:
> 	Test both between and substring procedures.
>
> tests/hard_coded/string_codepoint.exp:
> tests/hard_coded/string_codepoint.exp2:
> tests/hard_coded/string_codepoint.m:
> 	Update names in test outputs.
>
> NEWS:
> 	Announce the change.
>
> diff --git a/NEWS b/NEWS
> index 172fe6b..fa2cb74 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -108,15 +108,24 @@ Changes to the Mercury standard library:
> 	bitmap.new/2
> 	hash_table.new/3
> 	hash_table.new_default/1
> -	store.new/1
> 	semaphore.new/1
> 	semaphore.new/3
> +	store.new/1
> +	string.foldl2_substring/8
> +	string.foldl_substring/5
> +	string.foldl_substring/6
> +	string.foldr_substring/5
> +	string.foldr_substring/6
> +	string.substring/3
> +	string.substring/4
> +	string.unsafe_substring/3
> +	string.unsafe_substring/4
> 	version_array.new/2
> 	version_array2d.new/3
> 	version_bitmap.new/2
> 	version_hash_table.new/3
> -	version_hash_table.unsafe_new/3
> 	version_hash_table.new_default/1
> +	version_hash_table.unsafe_new/3
> 	version_hash_table.unsafe_new_default/1
> 	version_store.new/0

The diff looks fine otherwise.

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