Empty VS null array?

ProgrammingGhost dsioafiseghvfawklncfskzdcf at sdifjsdiovgfdisjcisj.com
Fri Oct 18 13:32:46 PDT 2013


On Friday, 18 October 2013 at 20:09:37 UTC, Blake Anderton wrote:
> I agree a null value and empty array are separate concepts, but 
> from my very anecdotal/non rigorous point of view I really 
> appreciate D's ability to treat them as equivalent.
>
> My day job mostly involves C# and array code almost always 
> follows the pattern if(arr == null || arr.Length == 0) ...
>
> In D just doing if(arr.length) feels much nicer and less error 
> prone. I'm all for correctness but would hate to throw the baby 
> out with the bathwater.

Really? I NEVER write that pattern. I may check if an array is 
null or don't because the function shouldnt be receiving nulls 
(maybe its bad but idc). I just write linq and never bother to 
see if something is empty


More information about the Digitalmars-d mailing list