Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21884 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66004 invoked by uid 1010); 16 Feb 2006 17:28:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 65989 invoked from network); 16 Feb 2006 17:28:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2006 17:28:18 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:32239] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E3/80-61409-036B4F34 for ; Thu, 16 Feb 2006 12:28:17 -0500 Received: (qmail 28208 invoked from network); 16 Feb 2006 17:28:12 -0000 Received: from localhost (HELO zeev-notebook.zend.com) (127.0.0.1) by localhost with SMTP; 16 Feb 2006 17:28:12 -0000 Message-ID: <7.0.1.0.2.20060216192615.099c9598@zend.com> X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Date: Thu, 16 Feb 2006 19:28:10 +0200 To: "Sara Golemon" Cc: ,"Andi Gutmans" In-Reply-To: <002201c6331d$a79473b0$58d01a44@stumpy> References: <002201c6331d$a79473b0$58d01a44@stumpy> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: Minor engine patch to facilitate PECL/operator From: zeev@zend.com (Zeev Suraski) At 19:23 16/02/2006, Sara Golemon wrote: >Hi, purely selfish request here, I'd like to make a minor change to >the parser... Just a bitty one... You won't even feel it... > >Currently, when the parser encounters: expr1 > expr2 it quietly >(and reasonably) switches it around to expr2 < expr1 so that is can >reuse the ZEND_IS_SMALLER op. The executor has no idea this has >occured, but heck, why does it need to know after all? > >Enter PECL/operator, which tries to implement operator overloading >for objects (and does a decent job at that). In the interrest of >ease of use and consistency, every overloaded binary operator is >[meant to be] left associative. This is, in the expression expr1 >op expr2 expr1 gets to decide how it will combine-with/compare-to expr2. What does it mean that it gets to decide? If it's left associative, then it's evaluated from left to right, no? >Since greater-than (and greater-than-or-equal-to) are quietly >flipped, PECL/operator has no way to tell the difference between the >two and has to assume op1 < op2 (when in fact op2 > op1 may be the >correct view). To solve this I've bundled a patch with >PECL/operator to set the otherwise unused extended_value to a 0/1 >value depending on whether it's genuinely less-than or greater-than. > >There are sleaker ways to do this than what's included in the patch >(e.g. a new zend_do_() method really isn't needed), but I was >attempting to touch as little as possible in implementing it. > >Is there a chance of this getting merged into the engine? Or is >that just entirely too imposing for such an edge case extension. > >http://cvs.php.net/viewcvs.cgi/pecl/operator/compare-greater-5.1.2.diff?view=markup&rev=1.2 The patch looks harmless enough but I'm not clear on why it's needed, which makes me worry whether there's some 'magic' involved here... Can you try to elaborate on what would be going wrong w/o it? Zeev