[Vala] Null Coalescing Assignment Operator



This snippet shows a common implementation of lazy initialization:

        if (thing == null)
        {
            thing = create();
        }


It would be nice to have a concise form using a null coalescing operator, like:

        thing ??= create();


Would a null coalescing assignment operator be a reasonable addition to Vala?

Ed


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]