Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70764 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20320 invoked from network); 19 Dec 2013 22:11:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Dec 2013 22:11:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=rmwscbt@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rmwscbt@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: rmwscbt@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:65490] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/CC-42949-FFE63B25 for ; Thu, 19 Dec 2013 17:11:11 -0500 Received: by mail-wi0-f176.google.com with SMTP id hq4so7582849wib.9 for ; Thu, 19 Dec 2013 14:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=SKEDC/CbYXV4QJng+M+zsA5zcCmC+TrfNv3d/l2tLHE=; b=eWCLe7PiEz70pT23KLOckRY0V92dmr2l8/D0HoZ1Uhk4r+QdxCq9vHE8LeGp3Xo1go m7oxqmPHhntW4x87DA/UB0ADy1gjOoiql8XscBBmQt1Mz9pb85HUOiL9gyS3xZ+Xi96J c7s9htt1bxykOF/0h8S/QTO9aD41zRB25kLG9okt11ckFHSMCWlze/ARCjj9aYNnUYEA sUxg/c4kPcWAFWjGvTulkrHbtDyGMhyPCbfSBAcOgkmgwUlKcqJV4IsSwuKAy+14ZGsn zylltZKNuv3qOiXXAkVCH2/LkFlMHwCAH23jnlpPkW+4e8TM2DatrSZPqUMHUjjC/CPV +p5A== MIME-Version: 1.0 X-Received: by 10.180.106.229 with SMTP id gx5mr4519661wib.55.1387491063382; Thu, 19 Dec 2013 14:11:03 -0800 (PST) Received: by 10.216.199.130 with HTTP; Thu, 19 Dec 2013 14:11:03 -0800 (PST) In-Reply-To: <52B36BFC.4080708@lerdorf.com> References: <52B36BFC.4080708@lerdorf.com> Date: Thu, 19 Dec 2013 14:11:03 -0800 Message-ID: Cc: "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: power operator (again) From: rmwscbt@gmail.com (George Wilson) 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. On Thu, Dec 19, 2013 at 1:58 PM, Rasmus Lerdorf wrote: > On 12/19/2013 04:50 PM, Kris Craig wrote: >> I believe that, especially for a KISS language like PHP, our top priority >> with math operators should be to match arithmetic laws as closely and as >> intuitively as possible. The average PHP developer is going to do -3 ** 2 >> and expect a result of 9, not -9, and rightly so I think. > > No, the average PHP developer is going to do $var ** 2 and it will > behave exactly as they expect with negative values. Yes, in the very > rare case that someone for some reason hardcodes a negative literal > there, they are going to have to learn about operator precedence because > we really can't have 0 - 3**2 be different from - 3**2. > > -Rasmus > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >