<div class="gmail_quote">2012/2/28 Jesse Phillips <span dir="ltr"><<a href="mailto:jessekphillips%2BD@gmail.com">jessekphillips+D@gmail.com</a>></span> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote>
<br>
string is an array, alias immutable(char)[], so the same rules apply.<br></blockquote><div><br></div><div>I know about string being an alias, hence the question. This means that I can do    if (someString.length) { ... }    without worrying about the null case (?). That's great!</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
There is no NullPointerException, it is a segfault/Access Violation/Bus Error.<br>
<br></blockquote><div><br></div><div>Ah, that will take some getting used to. =)</div><div>I guess there's a good reason though (there seems to be good reasoning behind most of the design choises). Off topic, but may I ask what might be the reason?</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
An empty array and a null array are equal. And this definition does work well.<br>
<br>
You can distinguish between an empty array and a null array by using the 'is' operator. What is pointed out here is that an empty array literal, [], is null while an empty array is not. This behavior is easy to explain in terms sf why, but may not be a good choice for sake of consistency.<br>
</blockquote><div><br></div><div>Yes, that feels kind of "wrong" to me - that an empty array literal is null while an empty array isn't. It's not intuitive, easily explainable or not.</div><div><br></div>
<div><br></div><div>/ Mikael</div></div>