Re: Re: rfc: pow-operator
| From: | Sean Coates | Date: | Sun, 24 Nov 2013 17:21:26 +0000 |
| Subject: | Re: Re: rfc: pow-operator | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70356@lists.php.net to get a copy of this message | ||
> Should it not be possible to do something similar than isset? Changing
> pow from a function to operator? The big advantage is that any
> existing code will benefit from it without code changes.
This approach also makes the syntax much less ambiguous:
pow(-3, 2) // we know what this does, already…
Perhaps the only drawback to this is in the strict comparison operator (if it returns a GMP object
instead of strictly a number)…?
As a further aside: in 15 years of PHP dev, I've rarely used pow() and I've never ever
seen it show up as a bottleneck of any sort in profiling. Searching GitHub correlates that I'm
not alone here: for PHP, a search for "pow(" yields 280,769 code results vs. 4,886,604 for
"trim(". At a glance, many of these are inefficient bitwise operations.
S