Re: Re: rfc: pow-operator

From: Date: Mon, 25 Nov 2013 07:01:11 +0000
Subject: Re: Re: rfc: pow-operator
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-70369@lists.php.net to get a copy of this message
On Mon, Nov 25, 2013 at 8:38 AM, Tjerk Meesters <tjerk.meesters@gmail.com>wrote: > Hi Pierre, > > > On Sun, Nov 24, 2013 at 11:56 PM, Pierre Joye <pierre.php@gmail.com>wrote: > >> On Sun, Nov 24, 2013 at 4:26 PM, Chris London <me@chrislondon.co> wrote: >> > On Sun, Nov 24, 2013 at 7:15 AM, Tjerk Meesters < >> tjerk.meesters@gmail.com>wrote: >> >> >> >> 2. The available votes for the associativity is reduced to either >> right or >> >> non associative; I'd rather see it done right (pun intended) or done >> in a >> >> way whereby the developer must put parentheses to disambiguate. >> >> >> > >> > I completely agree. Here's another resource that explains a little more >> why >> > the exponent comes before the negation: >> > http://mathforum.org/library/drmath/view/55709.html >> >> Replying here about the general idea of having power as an operator, I >> really like the optimization brought by this change. >> >> However I don't really like ** and all the confusions it brings >> (whether other languages support it or not, from a precedence point of >> view). >> >> 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. >> > > Speeding up existing code sounds like a very good idea actually :) I'll > look into this. > Following up on this; I've turned pow() into a language construct now. The only caveat I could see is: pow(array(), 2) === int(0) // used to be float(0) Otherwise this gives all the advantages of the operator without developers having to change anything, which is great! This will get added to the RFC soon. And thanks for the idea :) > >> >> Cheers, >> -- >> Pierre >> >> @pierrejoye | http://www.libgd.org >> > > > > -- > -- > Tjerk > -- -- Tjerk

« previous php.internals (#70369) next »