After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 777345 - Support null-conditional operators
Support null-conditional operators
Status: RESOLVED DUPLICATE of bug 761267
Product: vala
Classification: Core
Component: Parser
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-01-16 16:59 UTC by Jeeyong Um
Modified: 2017-01-17 00:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add support for null-conditional operators (13.96 KB, application/mbox)
2017-01-16 16:59 UTC, Jeeyong Um
Details

Description Jeeyong Um 2017-01-16 16:59:29 UTC
Created attachment 343576 [details]
add support for null-conditional operators

C# 6.0 supports null-conditional operators "?." and "?[", and developers can handle assigning value to local variable (for thread safety), null-check and method invocation (or member access) with them easily.

  obj?.call_method ();

Preceding expression can be translated into the following lines.

  var local = obj;
  if (local != null) {
    local.call_method ();
  }

For more description, please see here. (https://msdn.microsoft.com/en-us/library/dn986595.aspx)

Attached patch includes implementations of null-conditional operators on vala.
Comment 1 Rico Tzschichholz 2017-01-16 19:49:43 UTC
Please attach your proposal to this existing bug report for this matter.

https://bugzilla.gnome.org/show_bug.cgi?id=761267
Comment 2 Rico Tzschichholz 2017-01-16 19:50:00 UTC

*** This bug has been marked as a duplicate of bug 761267 ***
Comment 3 Rico Tzschichholz 2017-01-16 19:50:55 UTC
In parallel to this there should be a bunch of test-cases added.
Comment 4 Jeeyong Um 2017-01-17 00:54:59 UTC
Comment on attachment 343576 [details]
add support for null-conditional operators

Please see bug 761267 for improved one for this.