TDPL reaches Thermopylae level

Denis Koroskin 2korden at gmail.com
Tue Oct 27 04:37:56 PDT 2009


On Tue, 27 Oct 2009 10:04:33 +0300, Chris Nicholson-Sauls  
<ibisbasenji at gmail.com> wrote:

> Andrei Alexandrescu wrote:
>> Bill Baxter wrote:
>>> On Mon, Oct 26, 2009 at 11:51 AM, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>> Bill Baxter wrote:
>>>>> On Mon, Oct 26, 2009 at 8:47 AM, Jeremie Pelletier  
>>>>> <jeremiep at gmail.com>
>>>>> wrote:
>>>>>> Andrei Alexandrescu wrote:
>>>>>>> 303 pages and counting!
>>>>>>>
>>>>>>> Andrei
>>>>>> Soon the PI level, or at least 10 times PI!
>>>>>>
>>>>> A hundred even. ;-)
>>>> Coming along. I'm writing about strings and Unicode right now. I was
>>>> wondering what people think about allowing concatenation (with ~ and  
>>>> ~=) of
>>>> strings of different character widths. The support library could do  
>>>> all of
>>>> the transcoding.
>>>>
>>>> (I understand that concatenating an array of wchar or char with a  
>>>> dchar is
>>>> already in bugzilla.)
>>>
>>> So a common way to convert wchar to char might then become  
>>> ""~myWcharString?
>>>
>>> That seems kind of odd.
>>  Well, I guess. In particular, to me it's not clear what type we should  
>> assign to a concatenation between a string and a wstring. With ~=, it's  
>> much easier...
>>
>
> My intuition would be to expect the same as adding an int to a byte: you  
> get an int. Concatenating a string and a wstring should yield a wstring;  
> ie, encode to the wider of the two types.
>
> -- Chris Nicholson-Sauls

ubyte i = 42;
int j = 1;

i += j; // still ubyte

same here:

string a = "hello";
wstring b = "world"w;

a ~= b; // still string



More information about the Digitalmars-d mailing list