rfc:list_reference_assignment

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
rfc:list_reference_assignment [2017/01/11 22:38] bp1222rfc:list_reference_assignment [2017/12/09 12:43] (current) – Implemented nikic
Line 6: Line 6:
   * Original Date: 2013-10-24   * Original Date: 2013-10-24
   * Original Author: Andrea Faulds, ajf@ajf.me   * Original Author: Andrea Faulds, ajf@ajf.me
-  * Status: Under Discussuon+  * Status: Implemented (in PHP 7.3)
   * First Published at: http://wiki.php.net/rfc/list_reference_assignment   * First Published at: http://wiki.php.net/rfc/list_reference_assignment
  
Line 88: Line 88:
  
  
-The predominant advantage of adding support for this is that it allows you to use reference assignment for multiple variables at once, which is not currently possible. The syntax here is different from the traditional assignment syntax which places the ''&'' before the right-side value, not the left-side value; the advantage here is that you can reference assign some, but not all of the variables in list(). [See Open Issues]+The predominant advantage of adding support for this is that it allows you to use reference assignment for multiple variables at once, which is not currently possible. The syntax here is different from the traditional assignment syntax which places the ''&'' before the right-side value, not the left-side value; the advantage here is that you can reference assign some, but not all of the variables in list().
  
 The RFC also takes into account the possibility of objects being the r-val of the assignment implementing ArrayAccess. The RFC also takes into account the possibility of objects being the r-val of the assignment implementing ArrayAccess.
Line 132: Line 132:
 Maybe, I don't know enough about opcache to say if changing current ops by adding an extended value would impact. Maybe, I don't know enough about opcache to say if changing current ops by adding an extended value would impact.
  
-===== Open Issues ===== +===== Proposed Voting Choices ===== 
-==== Both Syntax ==== +Voting starts on 2017-02-06 17:30 UTC and closes on 2017-02-22 20:00 UTC
-The proposal follows the syntactic choice in allowing you to specify to each element in the list() which should be referenced into the target array.  The question if if you wanted to reference everything, should we also support the syntax: +
-<file php> +
-<?php +
-$array = [1, 2, 3]; +
-list($a, $b, $c) =& $array; +
-</file>+
  
-Which would be identical to proposed syntax: +2/Vote Required 
-<file php> +Vote Yes to allow reference assignments as part of list() assignments 
-<?php +Vote No to maintain current functionality
-$array = [1, 23]; +
-list(&$a, &$b, &$c= $array; +
-</file>+
  
-===== Proposed Voting Choices ===== +<doodle title="list() Reference Assignments" auth="bp1222" voteType="single" closed="true"> 
-Will require 2/3+   * Yes 
 +   * No 
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
-  * Working Implementation: https://github.com/php/php-src/compare/master...bp1222:fix-7930+  * Working Implementation: https://github.com/php/php-src/pull/2371
   * Language Spec: https://github.com/php/php-langspec/compare/master...bp1222:fix-7930   * Language Spec: https://github.com/php/php-langspec/compare/master...bp1222:fix-7930
  
 ===== Implementation ===== ===== Implementation =====
-Link to commit and docs when completed.+ 
 +Implemented in PHP 7.3 via https://github.com/php/php-src/commit/6d4de4cf0582cf33848826ab78aae58077dc2dea.
  
 ===== References ===== ===== References =====
rfc/list_reference_assignment.1484174312.txt.gz · Last modified: 2017/09/22 13:28 (external edit)