Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70351 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33552 invoked from network); 24 Nov 2013 11:31:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Nov 2013 11:31:59 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:46612] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/F3-10115-DA3E1925 for ; Sun, 24 Nov 2013 06:31:58 -0500 Received: by mail-vb0-f42.google.com with SMTP id w18so2137641vbj.1 for ; Sun, 24 Nov 2013 03:31:55 -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:to :cc:content-type; bh=guvpJYbj2229gyE20dgGniB95HUHF1bdJFS4qOjt0eY=; b=UEHfbtB6XHfvDRCPiydaYwwNg5J1c8Ace1bcIVnvmLfrRzZ4l3LwGszjEUJCWQ/lPb QGY6UkykVkonnZcR3sfrNUYaRtK5L6B2kSojhuMSwBSDrYo8vVbEOyESlO2PtegtBnAC A2CvXXrO9YXHaa5C6Lvm9eZb9f20ROwvxtTk1zYMlYp50JwZlJWlB1e6dlAKNseNSLuH RWQ7f8lBzM2lOzXliqZlFxWdoJoUYdSkXWFEUKOjDhSn0e0ctxAwxrBUgkFBcNn8k2oU 8LTuny3VU1tMVODd0qKNwmCuPx7aT8DyDtvnR6Tg0OT3I4AJnbcXDDemhuZQvAMk8XUo MSKg== MIME-Version: 1.0 X-Received: by 10.58.255.233 with SMTP id at9mr477340ved.20.1385292715035; Sun, 24 Nov 2013 03:31:55 -0800 (PST) Received: by 10.58.128.33 with HTTP; Sun, 24 Nov 2013 03:31:54 -0800 (PST) In-Reply-To: References: Date: Sun, 24 Nov 2013 19:31:54 +0800 Message-ID: To: Nikita Popov Cc: Kris Craig , Derick Rethans , PHP Internals Content-Type: multipart/alternative; boundary=047d7bf15fc830c40804ebea983e Subject: Re: [PHP-DEV] rfc: pow-operator From: tjerk.meesters@gmail.com (Tjerk Meesters) --047d7bf15fc830c40804ebea983e Content-Type: text/plain; charset=ISO-8859-1 On Sun, Nov 24, 2013 at 7:05 PM, Nikita Popov wrote: > On Sun, Nov 24, 2013 at 7:58 AM, Tjerk Meesters wrote: > >> On Sun, Nov 24, 2013 at 8:31 AM, Kris Craig wrote: >> >> > We should be following standard Order of Operations here. As such, the >> > option of no associativity should be included. Furthermore, there >> needs to >> > be a voting option regarding how to deal with even exponents of negative >> > bases; i.e. treat "-3 ^ 2" as "-3 ^ 2 == 9" or as "-(3 ^ 2) == -9". >> > >> >> To support the latter "-3 ** 2 == 9" we would require a unary minus that >> has a higher precedence than the exponent operator and as such falls >> outside of the scope of this RFC. >> >> That said, I'm not even sure whether we can support a unary minus with the >> current parser. >> > > Huh? We already support a unary minus with the current parser. It has the > same precedence and associativity as ++ (%prec). You can adjust the > relative precedence of ** and - by adjusting the relative precedence of ** > and T_INC (or making it completely independent if you like.) > Aha! I haven't yet learned all the Bison tricks :) With the unary minus in place (should we adjust the unary plus as well?), this would be the behaviour: -3 ** 2 == 9 1 -3 ** 2 == -8 I'll add this in the RFC. > > Nikita > -- -- Tjerk --047d7bf15fc830c40804ebea983e--