On Tue, Oct 27, 2009 at 4:37 AM, Denis Koroskin <2kor...@gmail.com> wrote: > On Tue, 27 Oct 2009 10:04:33 +0300, Chris Nicholson-Sauls > <ibisbase...@gmail.com> wrote: > >> Andrei Alexandrescu wrote: >>> >>> Bill Baxter wrote: >>>> >>>> On Mon, Oct 26, 2009 at 11:51 AM, Andrei Alexandrescu >>>> <seewebsiteforem...@erdani.org> wrote: >>>>> >>>>> Bill Baxter wrote: >>>>>> >>>>>> On Mon, Oct 26, 2009 at 8:47 AM, Jeremie Pelletier >>>>>> <jerem...@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 >
As Andrei said (and maybe you missed) "With ~=, it's much easier...". The only question is about what "a ~ b" should do. --bb