Re: [Vala] Null Coalescing Assignment Operator



What's wrong with:

    thing = thing ? create ();

Le samedi 27 mai 2017 à 16:46 -0700, Edward Hennessy a écrit :
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
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
-- 
Guillaume Poirier-Morency

Étudiant au baccalauréat en informatique à l'Université de Montréal
Stagiaire de recherche à l'IRIC

Mon blog: https://arteymix.github.io/
Mon projet de coopérative: https://pittoresque.github.io/
Clé PGP: B1AD6EA5

Attachment: signature.asc
Description: This is a digitally signed message part



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