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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jul 4 08:41:47 PDT 2013


On 7/4/13 8:02 AM, Regan Heath wrote:
> On Thu, 04 Jul 2013 15:35:30 +0100, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> 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?
>
> Being able to naturally specify a non-null empty array (literal) such
> that...
>
> char[] n = null;
> char[] e = [];
>
> assert(n is null)
> assert(e !is null);

And what would be the benefit of that?

Andrei



More information about the Digitalmars-d mailing list