Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67416 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41550 invoked from network); 13 May 2013 09:24:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 May 2013 09:24:39 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.49 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.49 mail-oa0-f49.google.com Received: from [209.85.219.49] ([209.85.219.49:55210] helo=mail-oa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/7A-55400-651B0915 for ; Mon, 13 May 2013 05:24:39 -0400 Received: by mail-oa0-f49.google.com with SMTP id k14so5566663oag.8 for ; Mon, 13 May 2013 02:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=00Go/1kVB4idtLxF2XqI0ThBD5MqDFpXxSuTPHL/lu0=; b=ZvPbmQMqYZREFJkwGb7bNAaCz8IDhbDtf21KCHH+d3lTzlXB0+fs5utamMbspd8Kdz EtVTVIvp27zDNi7N55jd1inb53CyCQUogszRKAcls8BwswHg43Nk2wqi8J9ZlC7P2VGs BKbqJb/iBGV0cBrrU7hMTSNdAQy2XP0oJksmWSnZn2q9kJLu8VDp0pgMUYyFhcV+IKbP q8jNf3GsdVUTIWJfCxrMtsh/VJhPveDQQMxj8WzMIXp3sIXgqAJvylxli8sOsI/D9szs VaNzkqHE1CrWi+6oA7nIlVC2S7hbt9YtLXG+n1grKoEEffAFFpUcNsVhtv3k7xsxdsyz S8tg== MIME-Version: 1.0 X-Received: by 10.60.125.232 with SMTP id mt8mr6408229oeb.33.1368437075925; Mon, 13 May 2013 02:24:35 -0700 (PDT) Received: by 10.182.49.136 with HTTP; Mon, 13 May 2013 02:24:35 -0700 (PDT) In-Reply-To: References: Date: Mon, 13 May 2013 11:24:35 +0200 Message-ID: To: Dmitry Stogov Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b41408ecf2ad304dc9615ef Subject: Re: [PHP-DEV] [RFC] Internal operator overloading and GMP improvements From: nikita.ppv@gmail.com (Nikita Popov) --047d7b41408ecf2ad304dc9615ef Content-Type: text/plain; charset=ISO-8859-1 On Mon, May 13, 2013 at 7:49 AM, Dmitry Stogov wrote: > Hi Nikita, > > The patch looks quite good. > However, it must slow down each comparison operator (even if it compares > two integers). > In most cases it shouldn't, as the comparisons usually go through the fast_is_*_functions, which have special handling for integers and doubles. is_equal_function itself for example is only used in the implementation of ZEND_CASE (why? shouldn't we use the fast_ one here too?) and stuff like array_search. I would suggest overloading of CMP operator instead of separate <, <=, ==, > !=, >, >=. > But yeah, that sounds like a better solution. The advantages I see: a) It will automatically work with sorting functions (and other stuff using compare_function). This is a pretty big plus. b) You don't have to implement the same (or similar) code for four (or six) operators. c) It (at least partially) also solves the concerns raised by Sara. Would need an additional object handler though (as compare_objects works only on objects, so it's currently not possible to support something like $gmp == 0). Nikita --047d7b41408ecf2ad304dc9615ef--