Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71230 invoked from network); 22 Nov 2013 19:49:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2013 19:49:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.196 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.196 imap4.ox.registrar-servers.com Received: from [192.64.116.196] ([192.64.116.196:44544] helo=imap4.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/CD-28674-D35BF825 for ; Fri, 22 Nov 2013 14:49:17 -0500 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id 0C49F560071; Fri, 22 Nov 2013 14:49:15 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap4.ox.registrar-servers.com Received: from oxmail.registrar-servers.com ([127.0.0.1]) by localhost (imap4.ox.registrar-servers.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id s0bvAcWn-Ig1; Fri, 22 Nov 2013 14:49:14 -0500 (EST) Received: from [192.168.0.13] (unknown [94.13.99.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id ACD90560075; Fri, 22 Nov 2013 14:49:12 -0500 (EST) Message-ID: <528FB534.6000605@ajf.me> Date: Fri, 22 Nov 2013 19:49:08 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Tjerk Meesters , PHP Internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Power function as operator From: ajf@ajf.me (Andrea Faulds) On 22/11/13 16:58, Tjerk Meesters wrote: > > It introduces the pow() function as an operator ** (double asterisk), as > can be found in languages such as Python (with perhaps the notable > difference that it's right associative there). > This is great! I like Python's ** operator and having it in PHP would be great too. It's a very versatile mathematical operator. With ** you get three for the price of one: You can do powers ($x ** 2), you can do square roots ($x ** (1/2)) and you can do reciprocals ($x ** -1), though for that last one there was already 1 / $x. I will definitely vote for this proposal if it works and you make an RFC. I do have one concern, however. It looks like your current pull request doesn't make gmp support it. Nikita's (nikic) proposal to add internal operator overloading so that the gmp library could support it has been merged in. So could you make it overloadable (if it isn't already), and make sure gmp supports it? Thanks! -- Andrea Faulds http://ajf.me/