Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
rfc:bigint [2015/02/15 01:44] – Small updates ajf | rfc:bigint [2015/02/15 02:39] – extended voting period ajf |
---|
====== PHP RFC: Big Integer Support ====== | ====== PHP RFC: Big Integer Support ====== |
* Version: 0.1.8 | * Version: 0.1.8 |
* Date: 2014-06-20 (Initial Draft; Put Under Discussion 2014-10-10, Last updated 2015-01-10) | * Date: 2014-06-20 (Initial Draft; Put Under Discussion 2014-10-10, Last updated 2015-02-15) |
* Author: Andrea Faulds, ajf@ajf.me | * Author: Andrea Faulds, ajf@ajf.me |
* Status: Under Discussion | * Status: Voting |
* First Published at: http://wiki.php.net/rfc/bigint | * First Published at: http://wiki.php.net/rfc/bigint |
| |
* ''intdiv'' supports big integers and will no longer return ''0'' for ''intdiv(PHP_INT_MIN, -1)'' (this is not a BC break assuming this RFC is accepted for PHP 7, because ''intdiv'' is a function introduced in PHP 7) | * ''intdiv'' supports big integers and will no longer return ''0'' for ''intdiv(PHP_INT_MIN, -1)'' (this is not a BC break assuming this RFC is accepted for PHP 7, because ''intdiv'' is a function introduced in PHP 7) |
* ''abs'', ''max'' and ''min'' gain big integer support | * ''abs'', ''max'' and ''min'' gain big integer support |
* ''pow'' gains big integer support as a result of the ''**'' operator being updated | * ''pow'' gains big integer support as a result of the ''*''''*'' operator being updated |
* ''array_sum'' and ''array_product'' are now implemented in the patch using ''add_function'' and ''mul_function'', respectively. This means that they now support not only bigints, but also internal objects with operator overloading | * ''array_sum'' and ''array_product'' are now implemented in the patch using ''add_function'' and ''mul_function'', respectively. This means that they now support not only bigints, but also internal objects with operator overloading |
| * ''decbin'', ''decoct'', ''dechex'' TBD |
| * Serialisation and unserialisation supports bigints |
| * ''gettype'', ''settype'', ''var_dump'', ''var_export'', ''print_r'', ''is_int''/''is_integer''/''is_long'' and ''debug_zval_dump'' gain bigint support |
| |
==== Examples ==== | ==== Examples ==== |
==== Arrays ==== | ==== Arrays ==== |
| |
Since ''HashTable'' has not been and will not be updated to support directly ''IS_BIGINT'' keys, indexing by an ''IS_BIGINT'' key must be handled somehow. The RFC proposes to simply convert the bigint to a string, thus <php>$x[PHP_INT_MAX + 1] = 3;</php> would be equivalent to <php>$x[(string)(PHP_INT_MAX + 1)] = 3;</php>. This is inconsistent with the behaviour of floats (which are blindly converted, wrapped and truncated by ''zend_dval_to_lval'''), but changing their behaviour might cause compatibility issues. If that became a problem, it could be addressed in a follow-up RFC. | Since ''HashTable'' has not been and will not be updated to support directly ''IS_BIGINT'' keys, indexing by an ''IS_BIGINT'' key must be handled somehow. The RFC proposes to simply convert the bigint to a string, thus <php>$x[PHP_INT_MAX + 1] = 3;</php> would be equivalent to <php>$x[(string)(PHP_INT_MAX + 1)] = 3;</php>. This is inconsistent with the behaviour of floats (which are blindly converted, wrapped and truncated by ''zend_dval_to_lval''), but changing their behaviour might cause compatibility issues. If that became a problem, it could be addressed in a follow-up RFC. |
| |
==== To SAPIs ==== | ==== To SAPIs ==== |
None I can think of particularly. | None I can think of particularly. |
| |
===== Proposed Voting Choices ===== | ===== Vote ===== |
| |
In some respects this is just an implementation detail, but as this would break backwards-compatibility for some apps and arguably changes the language, I think this requires a 2/3 majority. It would be a straight Yes/No vote. | As this is a language change (it affects the language specification), this requires a 2/3 majority. It is straight Yes/No vote to accepting the RFC. |
| |
| Voting started on 2015-02-15 and ends 10 days later on 2015-02-25. |
| |
| <doodle title="Big Integer Support RFC" auth="ajf" voteType="single" closed="false"> |
| * Yes |
| * No |
| </doodle> |
| |
===== Patches and Tests ===== | ===== Patches and Tests ===== |