Wide characters support in D

Ali Çehreli acehreli at yahoo.com
Mon Jun 7 15:48:50 PDT 2010


Ruslan Nikolaev wrote:

 > 1. When we have 2 methods (one with wchar[] and another with char[]), 
how D will determine which one to use if I pass a string "hello world"?

I asked the same question on the D.learn group recently. Literals like 
that don't have a particular encoding. The programmer must specify 
explicitly to resolve ambiguities: "hello world"c or "hello world"w.

 > 3. Even if they do support, it is kind of annoying to provide methods 
for all 3 types of chars. Especially, if we want to use native mode

I think the solution is to take advantage of templates and use template 
constraints if the template parameter is too flexible.

Another approach might be to use dchar within the application and use 
other encodings on the intefraces.

Ali


More information about the Digitalmars-d mailing list