Re: char[][] join == string

2011-04-07 Thread spir
On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays of chars. If I join

Re: char[][] join == string

2011-04-07 Thread spir
On 04/07/2011 09:52 AM, spir wrote: On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays

Re: char[][] join == string

2011-04-07 Thread spir
On 04/07/2011 09:52 AM, spir wrote: On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays

Re: char[][] join == string

2011-04-07 Thread Simen kjaeraas
On Thu, 07 Apr 2011 02:13:16 +0200, bearophile bearophileh...@lycos.com wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of

Re: char[][] join == string

2011-04-07 Thread Ali Çehreli
On 04/07/2011 01:04 AM, spir wrote: On 04/07/2011 09:52 AM, spir wrote: On 04/07/2011 03:07 AM, Ali Çehreli wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in

Re: char[][] join == string

2011-04-07 Thread Jesse Phillips
spir Wrote: unittest { string s = abc; char[] chars = cast(char[])s; chars ~= de; s = cast(string) chars; writeln(s, ' ', chars); // abcde abcde chars[1] = 'z'; writeln(s, ' ', chars); // azcde azcde } s's chars are mutable ;-) So, I guess there is /really/ no reason for

Re: char[][] join == string

2011-04-07 Thread bearophile
Jesse Phillips: Casting to and from string/char[] is very dangerous, even through assumeUnique. AssumeUnique is intended to be used for returning a mutable as immutable from a function. Casting is often a no-op for the CPU and as you discovered removes any safety provided by the type

char[][] join == string

2011-04-06 Thread bearophile
Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays of chars. If I join the arrays I get a mutable array of chars. But I

Re: char[][] join == string

2011-04-06 Thread Ali Çehreli
On 04/06/2011 05:13 PM, bearophile wrote: Given an array of strings std.string.join() returns a single string: import std.string; void main() { string[] a1 = [hello, red]; string j1 = join(a1, ); // OK } But in a program I need an array of mutable arrays of chars. If I join