Re: Re: power operator (again)
| From: | Rasmus Lerdorf | Date: | Thu, 19 Dec 2013 22:30:36 +0000 |
| Subject: | Re: Re: power operator (again) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70769@lists.php.net to get a copy of this message | ||
On 12/19/2013 05:11 PM, George Wilson wrote:
> Sorry, that was meant to goto the list.
>
> On Thu, Dec 19, 2013 at 2:09 PM, George Wilson <rmwscbt@gmail.com> wrote:
>> Maybe this is because my educational background is in Mathematics but
>> personally, I would tend to assume first (with just about any
>> language- unless I had reason to believe otherwise) that - blah is
>> equivalent to - (blah). FWIW, - 3 ** 2 === (-3) ** 2 would seem very
>> counter intuitive to me and I would probably gripe to myself about an
>> odd choice of operation syntax. This particularly makes sense given
>> Rasmus's example. The function
>>
>> function blah($argument){
>> return 3 - $blah ** 2
>> }
>>
>> Should not by default reverse the sign of $blah as the suggested
>> syntax might suggest. Again, just my thought.
Yeah, the 0 - 3 vs. - 3 example was actually not very accurate. You are
right, the - reverses the sign, so - 3 is more accurately described as
(-1) * 3. But that doesn't really change the larger point.
-Rasmus