Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81590 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40976 invoked from network); 2 Feb 2015 15:28:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 15:28:00 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.208 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.208 imap2-3.ox.privateemail.com Received: from [192.64.116.208] ([192.64.116.208:55645] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/01-34915-B779FC45 for ; Mon, 02 Feb 2015 10:27:59 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 4FE228C0080; Mon, 2 Feb 2015 10:27:52 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id BU_Covx-QmDh; Mon, 2 Feb 2015 10:27:52 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 992268C007D; Mon, 2 Feb 2015 10:27:51 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: Date: Mon, 2 Feb 2015 15:27:49 +0000 Cc: PHP Internals List Content-Transfer-Encoding: quoted-printable Message-ID: <1D2674AE-6DA6-42A4-817E-0166F30B667D@ajf.me> References: To: Nikita Popov X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] [VOTE] Combined Comparison (Spaceship) Operator From: ajf@ajf.me (Andrea Faulds) Hey Nikita, > On 2 Feb 2015, at 13:49, Nikita Popov wrote: >=20 > I've voted -1 because I think this should be a function and not an = operator. compare($a, $b) is more obvious than $a <=3D> $b and it's not = like writing comparison functions is such a super common use case that = it needs the extra brevity of an operator. A function can furthermore be = used as a callback, while an operator requires a wrapping closure. There=E2=80=99s no actual use for the bare comparison operation as a = callback, though: usort($foo, =E2=80=98compare=E2=80=99); would just be = a slow version of sort($foo); I agree that having it be available as a function might be useful in = some cases, but this is also true of most operators. I think it would be = better to add some means of obtaining a closure for PHP=E2=80=99s = operators, however. Thanks. -- Andrea Faulds http://ajf.me/