3 ms·
Unicode support is the biggest problem I have with OCaml, and it's something I noticed immediately as I tried to put in messages and keywords for a japanese fri
by microcolonel 12y ago
Unicode support is the biggest problem I have with OCaml, and it's something I noticed immediately as I tried to put in messages and keywords for a japanese friend.
It may not be wise to break current behaviour of the char and string types, but their literals should at least support unicode escapes. One way to do this would be to bring in UCS-4/UTF-32 strings as offered by Camomile, and have some simple convention to allow UCS-4 strings to be mapped from what are UTF-8 literals in the code.
- rwmj 12y agoI prefer that OCaml doesn't support Unicode in the core language, and that it's left to Camomile to support. One reason is that it's very hard to get it right -- see how complex Perl 5 is which is about the only language that does do the right thing. Another reason is that baking an incorrect Unicode into the language would be worse than the current situation. For examples of brokenness, see: all of Win32, Java, Ruby. It would be good to remove the broken String.lowercase and String.uppercase functions from the stdlib though. Edit: Although perhaps your problem was more to do with supporting arbitrary binary in the source files (which instead are encoded as ISO-8859-1). That would be something to fix.
- tel 12y agoHaskell has its Text library type. Which is a great example of how complex UTF done right can be... And how it can be done quite nicely as a lib. String literal overloading is pretty important (and library-level rare) though.