[:] as empty associative array literal, plus warning for null

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jul 4 08:51:13 PDT 2013


On 7/4/13 8:27 AM, Timon Gehr wrote:
> On 07/04/2013 04:35 PM, Andrei Alexandrescu wrote:
>> On 7/4/13 6:32 AM, Steven Schveighoffer wrote:
>>> I would not be opposed to a pull request that made [] be non-null, as
>>> long as it doesn't allocate.
>>
>> What would be the benefits?
>>
>> Andrei
>
> - Additional sentinel values at basically no cost.

OK, an "extra null". These can occasionally useful.

> - No accidental flawed relying on empty array is null or empty array !is
> null.
> (i.e. less nondeterminism.)

But null arrays stay, so this doesn't help with that. It may actually 
add confusion.

> - One thing less to discuss (this has come up before.)

That would be true if e.g. the null array disappeared. As such, this 
adds yet another type to the discussion.


Andrei


More information about the Digitalmars-d mailing list