What do you think about the "char" primitive in J2SDK 1.5
I think char's should not be 16-bit at the beginning (JDK 1.0). Then, there is no need to worry about things like "surrogate pairs" (Please see http://java.sun.com/developer/technicalArticles/Intl/Supplementary/ for more information).
In my opinion, char's should be stated as the following:
- One "char" contains exactly one Unicode character, no matter how big or small it is.
- "char" is not an integer type. So, "char" cannot be compared with integers (like boolean's).
- "char" can be compared to "char" by their Unicode value.
- String length is measured in number of chars (Unicode characters).
I am sure this will make the SDK implementors headache, because char's become variable length in bytes. But this will rescue all developers who use languages other than English (especially Asian languages). By this definition, no matter how unicode.org adds new characters / changes the definition, char's still represent one Unicode character.
Of course, there are still problems in this design. Please tell me what you think about this.
Thank you.
Asuka Kenji

