[m-rev.] preliminary review: UTF-8/16 support

Peter Wang novalazy at gmail.com
Mon Feb 21 13:34:03 AEDT 2011


On 2011-02-21, Paul Bone <pbone at csse.unimelb.edu.au> wrote:
> > index 6beb095..23d3884 100644
> > --- a/compiler/elds_to_erlang.m
> > +++ b/compiler/elds_to_erlang.m
> > @@ -1178,7 +1178,7 @@ write_with_escaping(StringOrAtom, String, !IO) :-
> >  write_with_escaping_2(StringOrAtom, Char, !IO) :-
> >      char.to_int(Char, Int),
> >      (
> > -        32 =< Int, Int =< 126,
> > +        32 =< Int, % Int =< 126,
> >          Char \= ('\\'),
> >          (
> >              StringOrAtom = in_string,
> 
> Is this an intentional change? is the commenting-out here temporary?

Intentional.

> > diff --git a/compiler/mlds_to_java.m b/compiler/mlds_to_java.m
> > index 3004247..cf9db1c 100644
> > --- a/compiler/mlds_to_java.m
> > +++ b/compiler/mlds_to_java.m
> > @@ -3449,7 +3449,8 @@ type_to_string(Info, MLDS_Type, String, ArrayDims) :-
> >          ArrayDims = []
> >      ;
> >          MLDS_Type = mlds_native_char_type,
> > -        String = "char",
> > +        % Java `char' not large enough for code points so we must use `int'.
> > +        String = "int",
> >          ArrayDims = []
> >      ;
> >          MLDS_Type = mlds_foreign_type(ForeignType),
> 
> Really?  I thought Java used UTF-16 and therefore char should be wide enough.
> Although if char is 16 bits wide I agree, that's too small.  Perhaps I don't
> understand have Java's multibyte character support works.

Java and C# char are both 16-bits wide.

Peter
--------------------------------------------------------------------------
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