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/08/31 19:21] 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, ''%%==>%%'' in Hack has slightly different semantics, hence we decided, it's better to not reuse that symbol. It also enables Hack to have ''~>'' and ''%%==>%%'' at the same time, with their slightly different semantics, in order to mirror PHP as much as possible, if necessary.
  
 ===== 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