rfc:match_expression

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:match_expression [2020/04/25 08:11]
ilijatovilo Fix list formatting
rfc:match_expression [2020/05/09 15:59] (current)
ilijatovilo Move to declined
Line 2: Line 2:
   * Date: 2020-04-12   * Date: 2020-04-12
   * Author: Ilija Tovilo, tovilo.ilija@gmail.com   * Author: Ilija Tovilo, tovilo.ilija@gmail.com
-  * Status: Under Discussion+  * Status: Declined
   * Target Version: PHP 8.0   * Target Version: PHP 8.0
   * Implementation: https://github.com/php/php-src/pull/5371   * Implementation: https://github.com/php/php-src/pull/5371
Line 261: Line 261:
 </code> </code>
  
-This introduces an ambiguity with the ''+'' and ''-'' prefix operators.+This introduces an ambiguity with the ''+'' and ''-'' unary operators.
  
 <code php> <code php>
Line 323: Line 323:
 </code> </code>
  
-The keyword ''match'' could be a bit misleading here. Because I have no strong opinion on this it will be moved to a secondary vote.+The keyword ''match'' could be a bit misleading here. A potential gotcha is passing truthy values to the match which will not work as intended. But of course this issue remains regardless of dropping ''(true)'' or not. 
 + 
 +<code php> 
 +match { 
 +    preg_match(...) => {}, // preg_match returns 1 which is NOT identical (===) to true 
 +
 +</code> 
 + 
 +Because I have no strong opinion on this it will be moved to a secondary vote.
  
 ===== Miscellaneous ===== ===== Miscellaneous =====
 ==== Arbitrary expressions ==== ==== Arbitrary expressions ====
-A match condition can be any arbitrary expression. Analogous to ''switch'' each condition will be checked from top to bottom until the first one matches. If a condition matches the remaining conditions won't be evaluated+A match condition can be any arbitrary expression. Analogous to ''switch'' each condition will be checked from top to bottom until the first one matches. If a condition matches the remaining conditions won't be evaluated.
  
 <code php> <code php>
Line 429: Line 437:
  
     // Algebraic data types if we ever get them     // Algebraic data types if we ever get them
-    let Ast\BinaryExpr($lhs, '+', $rhs) => ...,+    let Ast::BinaryExpr($lhs, '+', $rhs) => ...,
 } }
  
Line 521: Line 529:
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
 +Voting starts 2020-04-25 and ends 2020-05-09. 
 +
 As this is a language change, a 2/3 majority is required. As this is a language change, a 2/3 majority is required.
  
rfc/match_expression.1587802297.txt.gz · Last modified: 2020/04/25 08:11 by ilijatovilo