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

Peter Wang novalazy at gmail.com
Tue Jun 14 10:07:01 AEST 2011


On 2011-06-13, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
> 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.

How about:

diff --git a/NEWS b/NEWS
index fa2cb74..2347e52 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ Changes to the Mercury standard library:
 
 * We have improved Unicode support in the standard library.
 
+* We have deprecated substring procedures which take start and count
+  arguments in favour of procedures which take start and end arguments.
+
 * We have changed the argument order of many of the predicates in the array,
   bag, bimap, eqvclass, map, multi_map, queue and set modules in order
   to make them more conducive to the use of state variable notation.
@@ -34,6 +37,12 @@ Changes to the Mercury standard library:
 
     + Text I/O routines now read and write files in UTF-8 encoding.
 
+* We have deprecated substring procedures which take start and count
+  arguments in favour of procedures which take start and end arguments.
+  The new procedures are more convenient to call, make more sense with
+  variable-width character encodings, and pave the way for potentially
+  replacing string offsets with an abstract type.
+
 * We have added additional modes for set.map/3 and set.map_fold/5.
 
 * The argument order of the following predicates has been changed so as to
--------------------------------------------------------------------------
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