Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
Maybe lousy is too strong a word, but aside from compatibility with other libs/software that use it (which I'll address separately), UTF-16 is not particularly useful compared to UTF-8 and UTF-32: ... I tried to avoid commenting this because I am afraid we'll stray away from the main

Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
I'm well aware why UTF-32 is useful. Earlier, you had started out saying that there should only be one string type, the OS-native type. Now you're changing your tune and saying that we do need multiple types. No. From the very beginning I said it would also be nice to have some

Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
Is this what you want?     version (utf16)         alias wchar tchar;     else         alias char tchar;     alias immutable(tchar)[] tstring;     import std.utf;     unittest {         tstring tstr = hello;         dstring dstr = toUTF32(tstr);     } Yes, I think

Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
Generally Linux systems use UTF-8 so I guess the system encoding there will be UTF-8. But then if you start to use QT you have to use UTF-16, but you might have to intermix UTF-8 to work with other libraries in the backend (libraries which are not necessarily D libraries, nor system

Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
Every time you reply to somebody, a new message is created. Is kinda difficult to follow this discussion when you need to look more than 15 separated messages about the same issue. Please check your news client or something. Yao G. Sorry for that, I did not know there was some problem

Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
...@digitalmars.com wrote: From: Walter Bright newshou...@digitalmars.com Subject: Re: Wide characters support in D To: digitalmars-d@puremagic.com Date: Tuesday, June 8, 2010, 8:36 PM Ruslan Nikolaev wrote: No. From the very beginning I said it would also be nice to have some builtin function

Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
and click then reply - your flooding the newsgroup root with replies ... Am 08.06.2010 17:11, schrieb Ruslan Nikolaev:   Generally Linux systems use UTF-8 so I guess the system   encoding there will be UTF-8. But then if you start to use Speaking of top-posting... ;)

Re: Wide characters support in D

2010-06-08 Thread Ruslan Nikolaev
to other's comments. Ruslan. --- On Tue, 6/8/10, dennis luehring dl.so...@gmx.net wrote: From: dennis luehring dl.so...@gmx.net Subject: Re: Wide characters support in D To: digitalmars-d@puremagic.com Date: Tuesday, June 8, 2010, 10:11 PM Am 08.06.2010 19:55, schrieb Ruslan Nikolaev: Yeah

Re: Questions about Unicode, particularly Japanese

2010-06-08 Thread Ruslan Nikolaev
Sorry, if it's again top post in your mail clients. I'll try to figure out what's going on later today. 1. Am I correct in all of that? Yes. That's the reason I was saying that UTF-16 is *NOT* a lousy encoding. It really depends on a situation. The advantage is not only space but also

Wide characters support in D

2010-06-07 Thread Ruslan Nikolaev
Note: I posted this already on runtime D list, but I think that list was a wrong one for this question. Sorry for duplication :-) Hi. I am new to D. It looks like D supports 3 types of characters: char, wchar, dchar. This is cool, however, I have some questions about it: 1. When we have 2

Re: Wide characters support in D

2010-06-07 Thread Ruslan Nikolaev
Ok, ok... that was just a suggestion... Thanks, for reply about Hello world representation. Was postfix w and d added initially or just recently? I did not know about it. I thought D does automatic conversion for string literals. Yes, templates may help. However, that unnecessary make code

Re: Wide characters support in D

2010-06-07 Thread Ruslan Nikolaev
their code to be completely broken. Thanks, Ruslan. --- On Tue, 6/8/10, Ruslan Nikolaev nruslan_de...@yahoo.com wrote: From: Ruslan Nikolaev nruslan_de...@yahoo.com Subject: Re: Wide characters support in D To: digitalmars.D digitalmars-d@puremagic.com Date: Tuesday, June 8, 2010, 3:16 AM

Re: Wide characters support in D

2010-06-07 Thread Ruslan Nikolaev
It only generates code for the types that are actually needed. If, for instance, your progam never uses anything except UTF-8, then only one version of the function will be made - the UTF-8 version.  If you don't use every char type, then it doesn't generate it for every char type -

Re: Wide characters support in D

2010-06-07 Thread Ruslan Nikolaev
--- On Tue, 6/8/10, Jesse Phillips jessekphillip...@gmail.com wrote: I think you really need to look more into what templates are and do. Excuse me? Unless templates are something different in D (I can't be 100% sure since I am new D), it should be the case. At least in C++, that would be

Re: Wide characters support in D

2010-06-07 Thread Ruslan Nikolaev
). Thanks, Ruslan Nikolaev

Re: Wide characters support in D

2010-06-07 Thread Ruslan Nikolaev
You only need to do that where you are shipping closed source and for that, it should be trivial to get the compiler to generate all three versions. You will also need to do it in open source projects if you want to include generated template code into dynamic library as opposed to user's