Re: rfc: pow-operator
| From: | Robert Williams | Date: | Sun, 24 Nov 2013 11:33:05 +0000 |
| Subject: | Re: rfc: pow-operator | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70352@lists.php.net to get a copy of this message | ||
On Nov 23, 2013, at 23:28, "Sanford Whiteman"
<swhitemanlistens-software@cypressintegrated.com<mailto:swhitemanlistens-software@cypressintegrated.com>>
wrote:
Hmm... to me, this argument is pretty circuitous, as it assumes people
actively remember ( x ** y ) ** z == x ** ( y * z ) and yet are not
using the optimization nor parentheses.
Yes, people will use that simplification if they know it; that's sort of the point of using
right-associativity: it makes things easier and clearer in those cases where you actually *need* to
use exponentiation. Folks who don't use the operator that often will probably use parentheses
no matter what, or they'll just use pow() like they've always done. Those who will use the
operator regularly will know how it works, and they'll appreciate that they can use it without
having to include a bunch of extraneous parenthesis.
I'd also like to point out that PHP programmers are, well, programmers. I don't know about
you, but almost every programmer I know has a much stronger mathematical background than the average
person. Given this, I'm surprised at how much concern has been expressed in this discussion
that people won't understand how the operator works, nor be able to make the connection to
traditional math rules. It strikes me as another case of dumbing down the language so as to not
alienate the lowest-level amateur users.
Besides, I can just see all the "PHP sucks" articles out there being expanded with
examples showing how PHP gets basic math wrong when compared against trendy Ruby and Python, or
against the stalwart Perl. They'll further drive home the point by linking to Google (see https://www.google.com/search?q=2%5E3%5E2<https://www.google.com/search?q=2%5E3%5E2&ie=UTF-8&oe=UTF-8&hl=en&client=safari#hl=en&q=2%5E3%5E2>),
Wolfram Alpha (see http://m.wolframalpha.com/input/?i=2%5E3%5E2<http://m.wolframalpha.com/input/?i=2%5E3%5E2&x=-989&y=-72>),
or even Bing (see http://www.bing.com/search?q=2%5E3%5E2<http://www.bing.com/search?q=2%5E3%5E2&go=&qs=n&form=QBRE&pq=2%5E3%5E2&sc=8-5&sp=-1&sk=&cvid=c2f6cd7085814cc897d4d336504023f1>).
And you know what? They'll be right.
--
Bob Williams
________________________________
Notice: This communication, including attachments, may contain information that is confidential. It
constitutes non-public information intended to be conveyed only to the designated recipient(s). If
the reader or recipient of this communication is not the intended recipient, an employee or agent of
the intended recipient who is responsible for delivering it to the intended recipient, or if you
believe that you have received this communication in error, please notify the sender immediately by
return e-mail and promptly delete this e-mail, including attachments without reading or saving them
in any manner. The unauthorized use, dissemination, distribution, or reproduction of this e-mail,
including attachments, is prohibited and may be unlawful. If you have received this email in error,
please notify us immediately by e-mail or telephone and delete the e-mail and the attachments (if
any).