Re: [Vala] Vala Journal, Issue #1



Xavier Bestel wrote:
On Mon, 2010-02-01 at 14:44 +0800, Nor Jaidi Tuah wrote:
Coalesce operator (??) is now implemented in master. ;)
https://bugzilla.gnome.org/show_bug.cgi?id=580816
May I suggest adding ??=, as in
x ??= y;

Too bad C# choose ?? as the coalescing operator. GCC already has it and
simply uses the traditional ?: with an empty second argument, like:

      x = y ?: z;

which is, IMHO, quite easier to understand.

      Xav

There's a difference between Vala/C#/Java and C: only real boolean
expressions are allowed as conditions. Allowing a non-boolean expression
as first argument of the ?: operator in one case would be inconsistent.
So I think the null-check should have its own operator to avoid confusion.


Best regards,

Frederik



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