rfc:loop_or

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
rfc:loop_or [2014/09/19 21:39]
leigh created
rfc:loop_or [2014/10/03 20:25]
leigh Open vngoti
Line 2: Line 2:
   * Version: 1.0   * Version: 1.0
   * Date: 2014-09-19   * Date: 2014-09-19
-  * Author: ​Leigh, leight -> gmail +  * Author: ​leigh@php.net 
-  * Status: ​Under Discussion+  * Status: ​Voting
   * First Published at: http://​wiki.php.net/​rfc/​loop_or   * First Published at: http://​wiki.php.net/​rfc/​loop_or
  
Line 47: Line 47:
 Alternate syntax loops also gain this functionality with a ''​or:''​ clause. Alternate syntax loops also gain this functionality with a ''​or:''​ clause.
  
-This type of behaviour has been suggested before ​usually ​using the ''​else''​ keyword, originally ​the idea was to use the ''​default''​ keyword however this can break ''​switch''​ when using a semi-colon after the ''​default''​ keyword (thanks @ Paul Crovella) ​however ​using ''​else''​ especially has several drawbacks that make ''​or''​ more attractive:+This type of behaviour has been suggested before ​typically ​using the ''​else''​ keyword. There are several bug report feature requests for thisand several templating engines (i.e. Twig and Smarty) emulate this functionality for their users. 
 + 
 +The originally ​conceived alternative ​was to use the ''​default''​ keyword however this can break ''​switch''​ when using a semi-colon after the ''​default''​ keyword (thanks @ Paul Crovella). However ​using ''​else''​ especially has several drawbacks that make ''​or''​ more attractive:
  
  * Not backwards compatible by default due to dangling ''​else''​  * Not backwards compatible by default due to dangling ''​else''​
Line 141: Line 143:
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
-PHP.next (whether next is 7.0 or 5.7)+PHP 7
  
 ===== RFC Impact ===== ===== RFC Impact =====
Line 152: Line 154:
 ==== To Opcache ==== ==== To Opcache ====
 TODO - There may be an impact here, but any patch will review Opcache. This section needs commentary from internals. TODO - There may be an impact here, but any patch will review Opcache. This section needs commentary from internals.
- 
-===== Open Issues ===== 
-None 
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
Line 166: Line 165:
 There may be an opporunity to support the python style loop+else, but this will require a new keyword to preserve dangling else backward compatibility There may be an opporunity to support the python style loop+else, but this will require a new keyword to preserve dangling else backward compatibility
  
-===== Proposed Voting Choices ​=====+===== Vote =====
 This is a language change and requires a 2/3 majority in favour of the feature. This is a language change and requires a 2/3 majority in favour of the feature.
 +
 +<doodle title="​Loop + or control structure in PHP 7" auth="​leigh"​ voteType="​single"​ closed="​false">​
 +   * Yes
 +   * No
 +</​doodle>​
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
-A proof of concept ​is being worked on by Leigh - ''​while''​ and ''​for''​ are working ​''​foreach''​ currently segfaulting+[[https://​github.com/​lt/​php-src/​compare/​loop-or|Proof ​of concept]] no tests yet.
  
 ===== Implementation ===== ===== Implementation =====
Line 190: Line 194:
  
 ===== Changelog ===== ===== Changelog =====
 +2014-09-21 - Added proof of concept patch link.
 +
 +2014-09-20 - Changed target version to PHP 7
 +
 +2014-09-20 - Added details that templating engines emulate this behaviour
 +
 2014-09-19 - v1.0 - RFC created 2014-09-19 - v1.0 - RFC created
  
rfc/loop_or.txt · Last modified: 2017/09/22 13:28 (external edit)