rfc:increment_decrement_fixes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:increment_decrement_fixes [2020/03/01 20:25] – imsop | rfc:increment_decrement_fixes [2020/03/01 21:08] – ready for discussion imsop | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Increment/ | ====== PHP RFC: Increment/ | ||
- | * Version: | + | * Version: |
* Date: 2020-03-01 | * Date: 2020-03-01 | ||
- | * Author: Rowan Tommins, rowan.collins@gmail.com | + | * Author: Rowan Tommins |
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 25: | Line 25: | ||
Discrepancies in behaviour of null are particularly problematic, | Discrepancies in behaviour of null are particularly problematic, | ||
- | This RFC proposes to change the behaviour, so that < | + | This RFC proposes to change the behaviour, so that < |
^ ^ Initial Value ^ %%$a = $a + 1%% ^ %%$a += 1%% ^ %%++$a%%, %%$a++%% ^ %%$a = $a - 1%% ^ %%$a -= 1%% ^ %%--$a%%, %%$a--%% ^ | ^ ^ Initial Value ^ %%$a = $a + 1%% ^ %%$a += 1%% ^ %%++$a%%, %%$a++%% ^ %%$a = $a - 1%% ^ %%$a -= 1%% ^ %%--$a%%, %%$a--%% ^ | ||
Line 45: | Line 45: | ||
===== Proposal 3: Error when incrementing or decrementing an array ===== | ===== Proposal 3: Error when incrementing or decrementing an array ===== | ||
- | Adding an integer to an array produces | + | Adding an integer to an array throws |
- | This RFC proposes to change the behaviour so that < | + | This RFC proposes to change the behaviour so that < |
^ ^ Initial Value ^ %%$a = $a + 1%% ^ %%$a += 1%% ^ %%++$a%%, %%$a++%% ^ %%$a = $a - 1%% ^ %%$a -= 1%% ^ %%--$a%%, %%$a--%% ^ | ^ ^ Initial Value ^ %%$a = $a + 1%% ^ %%$a += 1%% ^ %%++$a%%, %%$a++%% ^ %%$a = $a - 1%% ^ %%$a -= 1%% ^ %%--$a%%, %%$a--%% ^ | ||
Line 55: | Line 55: | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | All of the proposed changes are explicit breaks in compatibility. The justification is that the current behaviour is neither intuitive nor useful, and it is unlikely that code is deliberately relying on it. | + | All of the proposed changes are explicit breaks in compatibility. The justification is that the current behaviour is neither intuitive nor useful. It is unlikely that code is deliberately relying on it, and it is likely that users would expect the behaviour to be consistent with adding 1. |
Line 89: | Line 89: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
+ | |||
+ | The three proposed changes can be implemented independently, | ||
* Should decrementing null result in -1? (Yes / No) | * Should decrementing null result in -1? (Yes / No) | ||
Line 105: | Line 107: | ||
===== References ===== | ===== References ===== | ||
- | * [[https:// | + | |
- | * [[https:// | + | * [[https:// |
- | * [[https:// | + | * [[https:// |
===== Rejected Features ===== | ===== Rejected Features ===== | ||
TODO | TODO |
rfc/increment_decrement_fixes.txt · Last modified: 2022/02/18 14:38 by imsop