On Wed, 16 May 2012 12:21:27 -0400, Gor Gyolchanyan <[email protected]> wrote:


if("" != []) assert("".length != 0);

Will this fail?

No. Ambiguities only come into play when you use 'is'. I highly recommend not using 'is' for arrays unless you really have a good reason, since two slices can be 'equal' but 'point at different instances'.

For example:

auto str = "abcabc";
assert(str[0..3] == str[3..$]); // pass
assert(str[0..3] is str[3..$]); // fail

which is very counterintuitive.

-Steve

Reply via email to