Re: Array Operations and type inference

2010-08-08 Thread bearophile
Sorry for the late answer, I am quite busy now. Mafi has already answered, I will probably repeat some things already said. simendsjo: Array ops currently have many bugs, they are fragile asm glass things, so when you use them you have to be kind, if you misuse them a bit things crash and

Re: Array Operations and type inference

2010-08-08 Thread bearophile
Don: That is bug 4578, which has been fixed, and will be in the next compiler release. Good, there is no need to file it then. simendsjo post shows two more cases, this is the first: { double[3] a = [1,1,1]; auto b = a[] + 3; // What happens here?

Re: Array Operations and type inference

2010-08-08 Thread simendsjo
On 07.08.2010 14:10, simendsjo wrote: I'm new to D2, so please.. :) (...) Thanks for all answers. Seems array operations is a bit buggy, so I'll rather look more into them at a later date.

Array Operations and type inference

2010-08-07 Thread simendsjo
I'm new to D2, so please.. :) The spec on Array Operations, http://www.digitalmars.com/d/2./arrays.html says: A vector operation is indicated by the slice operator appearing as the lvalue of an =, +=, -=, *=, /=, %=, ^=, = or |= operator. The following tests works fine as I expected:

Re: Array Operations and type inference

2010-08-07 Thread Mafi
Am 07.08.2010 14:10, schrieb simendsjo: I'm new to D2, so please.. :) The spec on Array Operations, http://www.digitalmars.com/d/2./arrays.html says: A vector operation is indicated by the slice operator appearing as the lvalue of an =, +=, -=, *=, /=, %=, ^=, = or |= operator. The following

Re: Array Operations and type inference

2010-08-07 Thread Mafi
Hey, here Mafi again, I thought about your snippets and here's what I have. Am 07.08.2010 14:10, schrieb simendsjo: { double[3] a = [1,1,1]; double[3] b; b[] = a[] + 3; assert(a == [1,1,1]); assert(b == [4,4,4]); } { double[3] a = [1,1,1]; auto b = a; b[] = a[] + 3; assert(a == [1,1,1]);

Re: Array Operations and type inference

2010-08-07 Thread Don
Mafi wrote: Hey, here Mafi again, I thought about your snippets and here's what I have. Am 07.08.2010 14:10, schrieb simendsjo: { // Like the previous example, but with dynamic arrays.. double[] a = [1,1,1]; auto b = a; assert(a is b); b = a[] + 3; assert(a == [1,1,1]); //writeln(b); //