Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70337 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96731 invoked from network); 24 Nov 2013 00:58:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Nov 2013 00:58:40 -0000 Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.171 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 209.85.214.171 mail-ob0-f171.google.com Received: from [209.85.214.171] ([209.85.214.171:55546] helo=mail-ob0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/21-25904-F3F41925 for ; Sat, 23 Nov 2013 19:58:40 -0500 Received: by mail-ob0-f171.google.com with SMTP id wp18so2845294obc.2 for ; Sat, 23 Nov 2013 16:58:36 -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=8yQFTF2tqWdRghw9lvEeoj7VMxLXIusPmtPb+oFJ1RU=; b=MMdqGyHnsJRb7FzePezIaK8dDbPLrQiLhjXQInIU0APO7aB+ouZcnNVg1EDtU7H/kv 5elosBvBrbpdUvtkjSZgotmaNY7npqduNR28ZUpPgdQNQakgIYk0NcuxhvEyhCvq8/fJ 4KAmI/RtCQ1DpqbuQLSYILM9HdFZLBS47vTQuGkXtZWsz0fabdImHpxCNZZFJCeMvhh8 57c06qMQmBNl4NBRrJ5qmjGFYL+6CklEZBd6zvCz0oB1UnB0ykoiSiuLyeWdZRxtr2oc iJ2OOzEb1NjObzi+KCWEiG4aDh35td38foCYnMTwBzu04ns3oBYsWqI5f6LhjJKwj3bE Pplg== MIME-Version: 1.0 X-Received: by 10.60.179.113 with SMTP id df17mr18174945oec.16.1385254716619; Sat, 23 Nov 2013 16:58:36 -0800 (PST) Received: by 10.182.221.170 with HTTP; Sat, 23 Nov 2013 16:58:36 -0800 (PST) In-Reply-To: <52914DA8.7050303@ajf.me> References: <52914DA8.7050303@ajf.me> Date: Sat, 23 Nov 2013 16:58:36 -0800 Message-ID: To: Andrea Faulds Cc: Derick Rethans , Tjerk Meesters , PHP Internals Content-Type: multipart/alternative; boundary=089e011609bc4ec1d304ebe1bfbd Subject: Re: [PHP-DEV] rfc: pow-operator From: kris.craig@gmail.com (Kris Craig) --089e011609bc4ec1d304ebe1bfbd Content-Type: text/plain; charset=ISO-8859-1 I don't see any benefit in using Python's unique behavior as a model. The model should conform to established mathematical laws, not some other arbitrarily chosen scripting language. According to Order of Operations, all operations of the same type within the same context (parentheses) must be processed in order from left to right. For example, -2 ** 3 ** 2 would be processed from left to right, like this: pow( pow( -2, 3 ), 2 ); We've introduced multiple options into RFCs before without encountering the problems you mention. The alternative would be to create a separate RFC that calls for behavior that conforms to established arithmetic standards. But it makes more sense to me to put that into one RFC rather than having two separate threads to discuss what should be one single issue. --Kris On Sat, Nov 23, 2013 at 4:51 PM, Andrea Faulds wrote: > > > On 24/11/13 00:31, 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". >> >> Without those options, my vote would be a firm No. >> >> > I am worried that adding so many options might cause problems. Is it fair > if it passes 3/4, but there is only a plurality for, say, > left-associativity or right-associativity? What if someone votes for it, > but would not have voted for it were it to be left-associative? > > I suggest that either Tjerk makes a decision for us and offers a straight > Yes/No choice, or he limits the choices to very few and combines them, so: > > * Yes, right-associative > > * Yes, left-associative > > * No > > Oh, and for my personal thoughts on the matter: I know ** from Python, and > I think (2 ** (3 ** 2)) is more useful than ((2 ** 3) ** 2), so I'd like > (-2 ** 3 ** 2) to be -(2 ** (3 ** 2)), just as Python does it. > > -- > Andrea Faulds > http://ajf.me/ > --089e011609bc4ec1d304ebe1bfbd--