Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67410 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10771 invoked from network); 12 May 2013 21:01:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2013 21:01:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.210.47 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.210.47 mail-da0-f47.google.com Received: from [209.85.210.47] ([209.85.210.47:42865] helo=mail-da0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/A6-55400-D0300915 for ; Sun, 12 May 2013 17:01:01 -0400 Received: by mail-da0-f47.google.com with SMTP id k13so943920dae.20 for ; Sun, 12 May 2013 14:00:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:x-originating-ip:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:x-gm-message-state; bh=gvbxerda5hbKisuzH5tVbSzHQBas75RKJffn0GIVPZU=; b=fdEj2Q97gt7hD+NKXq858vEBcTQoR9BbYJ/kqDf15Zolviv0HfIaXTyiIhTAlDwUrN avzBx0UCH2JRVHoIToIk1HW+av4ae2MbXvB3hB8VWDLJG4hUSU/y2Qzl8GzMfsh6G3id tC8+18WNjSfmxihMF2ftnhWKOvwsUMmoepVHeR20SbiBf0zUUW+bldHcEskymkvgG+bd h16zuIbbd+g83qSzPLKJkYvOWQKi/a/0gBo8IvMRvtoijPpN1BuaoV6/HWQonTdHGypD o0wBp/qjvooAPSEieHYRVC6aHHsS6MjoTWro34/5aObTd/VqAp3XqQHgTWqzpUNnRIXu BWkQ== MIME-Version: 1.0 X-Received: by 10.68.105.164 with SMTP id gn4mr26283264pbb.42.1368392458203; Sun, 12 May 2013 14:00:58 -0700 (PDT) Sender: php@golemon.com Received: by 10.70.51.229 with HTTP; Sun, 12 May 2013 14:00:58 -0700 (PDT) X-Originating-IP: [98.210.180.187] In-Reply-To: <518FFD17.4040202@sugarcrm.com> References: <518FD653.6070705@daylessday.org> <518FFD17.4040202@sugarcrm.com> Date: Sun, 12 May 2013 14:00:58 -0700 X-Google-Sender-Auth: G4QSs839T-nq6XIXYixb2D0PBQg Message-ID: To: Stas Malyshev Cc: Nikita Popov , Antony Dovgal , PHP internals Content-Type: multipart/alternative; boundary=047d7b67083d62840804dc8bb20a X-Gm-Message-State: ALoCoQnh6UzwY20y5sj8MVR4Hsmu1OnxQfJ+SJgIrtzRfbvfvuBH73JGUsAN7HUw/AN6X+bi4lPH Subject: Re: [PHP-DEV] [RFC] Internal operator overloading and GMP improvements From: pollita@php.net (Sara Golemon) --047d7b67083d62840804dc8bb20a Content-Type: text/plain; charset=ISO-8859-1 > > > Why would this be confusing? I'd agree if this happened in userland > (people > > could wonder why the operators are swapped), but internally we are > already > > dealing with this anyway. E.g. when you implement compare_objects you > have > > to be aware of this (to understand stuff like the return 1 trick). > > Your code suggests (even though RFC never says it) that the left operand > defines the comparison. However, for the switched operations, the right > operand would then define the comparison. It is pretty confusing, IMO. > > This. I see in zend_object_do_operation that op1 (LHS) has priority, but if it's not an object, then op2(RHS) gets the chance to handle it. So it works fine in the simple case of (Object and Non-Object), but if you have two different Objects, both implementing operator overloading in potentially different ways then the precedence order matters more. By having a separate opcode for GREATER, the user can explicitly state who they want to get precedence. I realize I'm potentially trying to solve a problem which doesn't exist, but separating out smaller/greater is a fairly trivial change, so I'd rather we did it now and avoid potential fail. -Sara --047d7b67083d62840804dc8bb20a--