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

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



--- Comment #6 from Stewart Gordon  2011-10-01 13:13:23 PDT ---
(In reply to comment #5)
> (In reply to comment #3)
>> 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.

Yes, an uncast [] is ambiguous.  But the original bug report isn't about that,
but about

aas ~= cast (string []) [];

which is completely unambiguous.

-- 
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

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


Denis Derman  changed:

   What|Removed |Added

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


--- Comment #5 from Denis Derman  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

2009-02-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2006


clugd...@yahoo.com.au changed:

   What|Removed |Added

Version|2.012   |1.028




--- Comment #4 from clugd...@yahoo.com.au  2009-02-19 07:06 ---
Applies equally to D1.


-- 



[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 ~= []'.


-- 



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

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


[EMAIL PROTECTED] changed:

   What|Removed |Added

 CC||[EMAIL PROTECTED]
   Keywords||wrong-code




--- Comment #2 from [EMAIL PROTECTED]  2008-11-21 15:08 ---
(In reply to comment #1)
> [] could be an empty array of any type.  So the compiler is interpreting it as
> an empty string[][], not an empty string[].  You have a T[], you concat an
> empty T[],  your original array isn't supposed to change.

But it has been explicitly cast to a string[].  How can a CastExpression be of
any type other than that to which it is cast?


--