[Issue 2006] Appending empty array using ~= doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 22 17:34:26 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2006





------- Comment #3 from wbaxter at gmail.com  2008-12-22 19:34 -------
I just got bitten by this again.

float[][] arr;
arr ~= [1.0]; // ok, adds a new element (an array of length 1).
arr ~= []; // not ok, does nothing. :-(

The last line there does nothing, apparently because the compiler interprets it
to be an array of array that's empty, which is the least useful interpretation.
 So I find it unexpected that the compiler interprets it this way.  Once
again... even though I already ran into it once.  I just forgot because it
seems so silly for the compiler to choose the interpretation that it does.

At the very least I'd like the compiler to generate an error saying it doesn't
know how to interpret 'arr ~= []'.


-- 



More information about the Digitalmars-d-bugs mailing list