[m-dev.] Unicode support in Mercury

Peter Wang novalazy at gmail.com
Tue May 10 22:15:02 AEST 2011


On 2011-05-10, Mark Brown <mark at csse.unimelb.edu.au> wrote:
> 
> If there's any possibility of making this change in future, it would be
> wise to add
> 
>     :- type char_index == int.
> 
> to the string module now, so that aforementioned conscientious programmers
> can start using it at their leisure and not have their code break when the
> change occurs.

That's a good idea for documentation anyway, although I would just name
it string.offset.  Further, we can add

    :- func string.start = offset.
    :- func string.end(string) = offset.
    :- func string.offset_to_int(offset) = int.
    :- func string.int_to_offset(int) = offset.

Then changing string.length to count code points will be easier as well.

Peter
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list