rfc:short_closures

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:short_closures [2015/05/01 19:16] bwoebirfc:short_closures [2015/09/01 16:30] bwoebi
Line 3: Line 3:
   * Date: 2015-05-01   * Date: 2015-05-01
   * Author: Bob Weinand, bobwei9@hotmail.com   * Author: Bob Weinand, bobwei9@hotmail.com
-  * Status: Draft+  * Status: Discussion
   * First Published at: http://wiki.php.net/rfc/short_closures   * First Published at: http://wiki.php.net/rfc/short_closures
  
Line 63: Line 63:
 </code> </code>
  
-Concrete syntax is (~> is right associative with lowest possible associativity):+Concrete syntax is (~> is right associative with lowest possible precedence):
 <code> <code>
   ( parameter_list ) ~> expression   ( parameter_list ) ~> expression
Line 255: Line 255:
 return [$x => $x * 2]; return [$x => $x * 2];
 </code> </code>
 +
 +Additionally, I was asked to not reuse the ''%%==>%%'' syntax (http://chat.stackoverflow.com/transcript/message/25421648#25421648) as Hack is already using it. Hence ''~>'' looks like a great alternative.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 270: Line 272:
     private $bar:     private $bar:
  
-    getBar ~> $this->bar;+    getBar() ~> $this->bar;
     setBar($bar) ~> $this->bar = $bar;     setBar($bar) ~> $this->bar = $bar;
 } }
rfc/short_closures.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1