On Thu, 12 Nov 2009 13:53:13 -0500, bearophile
<[email protected]> wrote:

>Max Samukha:
>
>> What's the advantage?
>
>null is for a pointer/reference. A dynamic array in D is a struct. 

Yes, but dynamic arrays in D are reference types (almost) and array
references (doesn't matter whether they are bare pointers or fat
references) can be tested for nullness and set to null. Like it or
not, there is a distinction between a null array and an empty array,
so I would prefer to use 'null' wherever I want to say 'null array
reference', meaning the struct's ptr member is definitely null.

> [] looks much better to denote an empty array-struct.
>
>Bye,
>bearophile
 

Reply via email to