bug? alias this <-> opDispatch interaction

Meta jared771 at gmail.com
Sat Nov 9 20:58:53 PST 2013


On Sunday, 10 November 2013 at 00:47:33 UTC, Luís Marques wrote:
> 1:    T[string] foo;
> 2:    foo[""] = new T;
> 3:    foo[null] = new T;
>
> Lines 2 and 3 seem to do the same, apparently. People seemed to 
> agree that 3 should not be relied upon (should it?), but if I 
> recall/understand it was not totally clear to people why 2 and 
> 3 *do* do the same thing, so feel free to clarify.

2 and 3 do the same thing because an empty slice is the same as 
null. I personally think this is a bad thing.


More information about the Digitalmars-d mailing list