rfc:operator_overloading_gmp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:operator_overloading_gmp [2013/05/17 19:04] – expand gmp proposal nikic | rfc:operator_overloading_gmp [2013/06/17 16:29] – Implemented nikic | ||
---|---|---|---|
Line 4: | Line 4: | ||
* Date: 2013-05-12 | * Date: 2013-05-12 | ||
* Author: Nikita Popov < | * Author: Nikita Popov < | ||
- | * Status: | + | * Status: |
* Patch: https:// | * Patch: https:// | ||
- | * Target version: PHP 5.6 (or whatever the next one is) | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 13: | Line 12: | ||
===== Proposal A: Operator overloading ===== | ===== Proposal A: Operator overloading ===== | ||
+ | |||
+ | Note: This proposal is only about **internal** operator overloading and **not** about userland overloading. | ||
==== Why operator overloading? | ==== Why operator overloading? | ||
Line 81: | Line 82: | ||
* Unsigned arithmetic and arithmetic on other integral types PHP does not support (e.g. cross platform 64bit integers) | * Unsigned arithmetic and arithmetic on other integral types PHP does not support (e.g. cross platform 64bit integers) | ||
* Vector and matrix calculations | * Vector and matrix calculations | ||
- | * (Misuse | + | |
+ | Due to potential pitfalls of misusing operator overloading known from other languages | ||
==== Technical proposal ==== | ==== Technical proposal ==== | ||
Line 195: | Line 197: | ||
object(GMP)# | object(GMP)# | ||
- | [" | + | |
- | string(1) " | + | string(1) " |
} | } | ||
object(GMP)# | object(GMP)# | ||
- | [" | + | |
- | string(1) " | + | string(1) " |
} | } | ||
</ | </ | ||
Line 222: | Line 224: | ||
</ | </ | ||
- | The following operators are supported: '' | + | The following operators are supported: '' |
=== Overloaded operators: Comparison === | === Overloaded operators: Comparison === | ||
Line 282: | Line 284: | ||
< | < | ||
| | ||
- | a) gmp_add($a, $b) 1.16 1.25 | + | a) gmp_add($a, $b) 1.07 1.25 |
- | b) gmp_add($a, 17) 1.08 1.21 | + | b) gmp_add($a, 17) 1.02 1.21 |
- | c) gmp_add(42, $b) 1.29 1.84 | + | c) gmp_add(42, $b) 1.20 1.84 |
- | d) $a + $b 0.83 --- | + | d) $a + $b 0.76 --- |
</ | </ | ||
Line 293: | Line 295: | ||
The pull request for this RFC can be found here: https:// | The pull request for this RFC can be found here: https:// | ||
+ | |||
+ | ===== Vote ===== | ||
+ | |||
+ | The vote started on 10.06.2013 and ended on 17.06.2013. Both proposals are accepted. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Internal operator overloading | ||
+ | * GMP changes | ||
+ | * None | ||
+ | </ | ||
===== Previous discussions ===== | ===== Previous discussions ===== | ||
- | http:// | + | http:// |
rfc/operator_overloading_gmp.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1