rfc:pow-operator
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:pow-operator [2013/12/19 08:09] – datibbaw | rfc:pow-operator [2013/12/21 05:45] – datibbaw | ||
---|---|---|---|
Line 4: | Line 4: | ||
* Date: 2013-11-23 | * Date: 2013-11-23 | ||
* Author: Tjerk Meesters, datibbaw@php.net | * Author: Tjerk Meesters, datibbaw@php.net | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
* Revision (0.1 → 0.2): 2013-12-19 | * Revision (0.1 → 0.2): 2013-12-19 | ||
Line 10: | Line 10: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This proposal is three-fold: | + | This proposal is two-fold: |
- | - Turn the existing [[http:// | + | - Introduce an exponential |
* Avoids a function call. | * Avoids a function call. | ||
* Support for [[rfc: | * Support for [[rfc: | ||
- | - Introduce an exponential (right associative) operator ''< | ||
* Easier to read and shorter to write. | * Easier to read and shorter to write. | ||
* Can be found in other languages. | * Can be found in other languages. | ||
Line 21: | Line 20: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | |||
- | **pow() as language construct** | ||
- | |||
- | No changes to existing code, safe for one: | ||
- | |||
- | <code php> | ||
- | var_dump(pow([], | ||
- | </ | ||
- | |||
- | **Power operator** | ||
A short working example: | A short working example: | ||
Line 76: | Line 65: | ||
echo ~3 ** 2; // -10 (not 16) | echo ~3 ** 2; // -10 (not 16) | ||
</ | </ | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | |||
+ | 21-Dec-2013: | ||
+ | 21-Dec-2013: | ||
===== Discussion ===== | ===== Discussion ===== | ||
Line 86: | Line 80: | ||
* http:// | * http:// | ||
* http:// | * http:// | ||
+ | |||
+ | **Similar languages** | ||
+ | |||
+ | * Ada | ||
+ | * D | ||
+ | * F# | ||
+ | * Fortran | ||
+ | * Freemat | ||
+ | * Haskell | ||
+ | * Mathematica / Matlab / Scilab | ||
+ | * Octave | ||
+ | * Perl | ||
+ | * Python | ||
+ | * R | ||
+ | * Ruby | ||
+ | * Sage | ||
+ | * VB / Basic | ||
+ | |||
+ | **Dissimilar languages** | ||
+ | |||
+ | * Bash | ||
+ | * Cobol | ||
+ | * ColdFusion | ||
+ | * Excel | ||
+ | * Tcl | ||
---- | ---- | ||
Line 99: | Line 118: | ||
* Octave | * Octave | ||
* Matlab | * Matlab | ||
- | * D | ||
* ColdFusion | * ColdFusion | ||
** Languages with right associative exponential operator** | ** Languages with right associative exponential operator** | ||
+ | * D | ||
* Haskell | * Haskell | ||
* R | * R | ||
Line 142: | Line 161: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | None. | + | An issue was brought up that due to pow() itself becoming a language construct, it would break existing code that uses " |
===== Vote ===== | ===== Vote ===== | ||
Line 159: | Line 178: | ||
---- | ---- | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes, right associative | ||
+ | * Yes, non associative | ||
+ | * No | ||
+ | </ | ||
---- | ---- |
rfc/pow-operator.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1