2012/2/28 Pedro Lacerda <pslace...@gmail.com> > So are a newly allocated array and a null one just the same thing? > > int[] a = [], b = null; > assert(a == b); > assert(a.length == b.length); > assert(a.ptr == a.ptr); > > Hi all,
Sorry if this is a stupid question - I'm new to D but I've been keeping an eye on it for quite a while (and also read the book). Coming from the Java/C# world, not distinguishing between an empty array and null feels strange to me. Is this so for strings as well? ...and in Pedros example, if you assign null to b and then try to access b.length, don't you get a NullPointerException? What am I missing? / Mikael