Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80822 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77176 invoked from network); 19 Jan 2015 14:32:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2015 14:32:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wg0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:61884] helo=mail-wg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/94-64889-59F0DB45 for ; Mon, 19 Jan 2015 09:07:18 -0500 Received: by mail-wg0-f49.google.com with SMTP id l18so6364592wgh.8 for ; Mon, 19 Jan 2015 06:07:15 -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=ZDyvLsZWGeA6YvFW65p8tDF422fBG534cil8OrahBx0=; b=H1RwzEEqSLtC8ZFwifTlvffBPAYiw5JDuNCWTXqp3GeOxMtvAjSzLVyX6B1N57sIsf wtktCP2/4LOXc3I22CNCkNrtIkHKrE118w+kUKmhkz5o2JgdfDIvSEcauEvpHDyaBY1g mWvFMYb3g6a2khJ112xN9a2HJ3Jv0lCjz8sPXoaT/7Le7orkNnjTYq74OP1D28SBCvoq iQpQrocYU9xCw3jjTpm0fvKOhlmHBLbvvUM0vwuMSrhDM+lAfKRGoQV2O6A0qaOYV4iU 4wbXO2yz1F3lJyDYe4+gPzvMeg90Iw8GYovn9M5t8QTUeHVYvFWvTzveGCLvdNQAqB4r SRIw== MIME-Version: 1.0 X-Received: by 10.194.108.202 with SMTP id hm10mr61496400wjb.72.1421676434956; Mon, 19 Jan 2015 06:07:14 -0800 (PST) Received: by 10.27.10.138 with HTTP; Mon, 19 Jan 2015 06:07:14 -0800 (PST) In-Reply-To: <53F8A1FF-C809-4DDF-9C6F-6916C3E4F044@ajf.me> References: <53F8A1FF-C809-4DDF-9C6F-6916C3E4F044@ajf.me> Date: Mon, 19 Jan 2015 15:07:14 +0100 Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: multipart/alternative; boundary=089e010d8a76e42628050d01d6bc Subject: Re: [PHP-DEV] [RFC] Combined Comparison (Spaceship) Operator From: nikita.ppv@gmail.com (Nikita Popov) --089e010d8a76e42628050d01d6bc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Jan 19, 2015 at 9:28 AM, Andrea Faulds wrote: > Good morning, > > This is a reboot of Davey Shafik=E2=80=99s RFC (with permission). After r= ecent > discussions about sort functions, I was inspired to bring this back up, a= s > I think it would be a useful feature. > > The RFC is here: https://wiki.php.net/rfc/combined-comparison-operator > > Thanks! > I like the idea behind this (exposing internal compare_function), but I don't want to have an extra operator for a minor use case. Please just introduce a function instead. The operator is also less clear ... if I see "$a <=3D> $b" and do not happe= n to be familiar with another language implementing this operator, I won't have any idea what it does (the closest thing <=3D> could be is the equivalence operator from logic, and that's not the case here). On the other hand something like compare($a, $b) is pretty obvious. If there is concern about clashing with user-defined functions, lets namespace it. A function can also be directly used as a callback. Furthermore a function would fit in well with existing comparison functions like strcmp etc. Nikita Nikita --089e010d8a76e42628050d01d6bc--