Re: Re: [vote] pow-operator
| From: | Tjerk Meesters | Date: | Thu, 19 Dec 2013 19:09:53 +0000 |
| Subject: | Re: Re: [vote] pow-operator | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70757@lists.php.net to get a copy of this message | ||
Hi Sean,
On Fri, Dec 20, 2013 at 2:18 AM, Sean Coates <sean@seancoates.com> wrote:
> Sorry I'm late (possibly too late?) to this, but:
>
> 1) if
pow() is turning from a function into a construct, can it
> still be
> used for callbacks? I don't see a mention of that part in the RFC.
>
It's implied in this section:
No changes to existing code, safe for one:
var_dump(pow([], 2)); // int(0) instead of float(0)
Perhaps it could be made more obvious, but yes, the original function
remains there to serve exactly the purpose of callbacks; its innards have
been replaced by calling the PHP_SAPI pow_function(), though.
> 2) if pow() drops the overhead of a function call, does
> -3 ** 2 really
> gain us anything over pow(-3, 2)? The latter is /far/ less
> ambiguous IMO.
>
Yes, it allows you to write an expression more naturally; regarding the
second part of your question, (-3) ** 2 is also far less ambiguous :)
> S
>
>
--
--
Tjerk