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

2011-01-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2006


Denis Derman denis.s...@gmail.com changed:

   What|Removed |Added

 CC||denis.s...@gmail.com


--- Comment #5 from Denis Derman denis.s...@gmail.com 2011-01-28 06:39:21 PST 
---
(In reply to comment #3)
 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 ~= []'.

Yes, ambiguity that is bug-prone, because both interpretations can run, must
yield compiler error.

Denis

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


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

2008-12-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2006





--- Comment #3 from wbax...@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 ~= []'.


--