Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81004 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86605 invoked from network); 23 Jan 2015 00:08:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jan 2015 00:08:20 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.181 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.181 mail-qc0-f181.google.com Received: from [209.85.216.181] ([209.85.216.181:36052] helo=mail-qc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/F4-61273-2F091C45 for ; Thu, 22 Jan 2015 19:08:19 -0500 Received: by mail-qc0-f181.google.com with SMTP id l6so4063360qcy.12 for ; Thu, 22 Jan 2015 16:08:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=PZNO56QQsCXXwRvIcAZIKkNGFbLXnWJDyFmIIs/U9Ys=; b=X1JfDaqijAqBxzRc6bmqt8buvuW3VHjr+GPNsPhIY9+wazpgg0SvhO8fHvA82G8469 kQBZoyUhD4obsOMudrcfMSALnrMaWr4XBIGYTHiy6nW6oKhqlCD5LGpEp1kzN+o7C0CI QSNhjVwt2UzlcUvn/icbfHzs9se7p1g47cVjQ0i0Po58VWyaQoRGFvtkKju2GXVul6Z3 UBl/IPxBvAipll5I0pqG23HZQ1aQ+LViH9w9ZmflUjB0VQQpY7Clcg+SgTnrfd0yLX7h g2j6ILdQ0u4wbdwpyrsgPU8IQ77+2Ujw2POlWcaPMX3Z0KCcy9OcdSK5ZblfzLfTi8co dlBg== X-Received: by 10.140.20.226 with SMTP id 89mr8004390qgj.43.1421971695626; Thu, 22 Jan 2015 16:08:15 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.93.70 with HTTP; Thu, 22 Jan 2015 16:07:35 -0800 (PST) In-Reply-To: <53F8A1FF-C809-4DDF-9C6F-6916C3E4F044@ajf.me> References: <53F8A1FF-C809-4DDF-9C6F-6916C3E4F044@ajf.me> Date: Fri, 23 Jan 2015 09:07:35 +0900 X-Google-Sender-Auth: frGBn30q2Wtfe8OjzqGEElARFgk Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c1257ecc7174050d469564 Subject: Re: [PHP-DEV] [RFC] Combined Comparison (Spaceship) Operator From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c1257ecc7174050d469564 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Andrea, On Mon, Jan 19, 2015 at 5:28 PM, Andrea Faulds wrote: > 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 > Ruby has it. Semantics is the same. http://ruby-doc.org/core-1.9.3/Comparable.html PERL has it. Semantics is the same. http://perldoc.perl.org/perlop.html#Operator-Precedence-and-Associativity Python has similar "<>", but it only compares equality. (the same as !=3D, !=3D=3D) [yohgaki@dev github-php-src]$ python Python 2.7.8 (default, Nov 10 2014, 08:19:18) [GCC 4.9.2 20141101 (Red Hat 4.9.2-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 1 <> 1 False >>> 1 <> 0 True >>> 1 <> 1 False >>> 1 <> 2 True MySQL has it. Different differs. It's for NULL comparison. http://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#operator_e= qual-to There is no reason not to have it, it seems. I suggest to add Ruby/PERL operator link to the RFC. I would like to name it other than T_SPACESHIP. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c1257ecc7174050d469564--