Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80842 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21535 invoked from network); 19 Jan 2015 18:25:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2015 18:25:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.47 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.218.47 mail-oi0-f47.google.com Received: from [209.85.218.47] ([209.85.218.47:57349] helo=mail-oi0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/BE-64889-40C4DB45 for ; Mon, 19 Jan 2015 13:25:08 -0500 Received: by mail-oi0-f47.google.com with SMTP id a141so2732036oig.6 for ; Mon, 19 Jan 2015 10:25:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=IM559ISUVo5z0rDFvBE2qI4m/97t5UA4wHbDY/B/UH0=; b=uwUY4iZiicEGikGZc/mW9EU86GttKrIe5J9GELr7RrwEvxpoaYIA/iefkPYsSen28P 6MKJw0DZ+PLHc5lBjlH42vO6GXNY2nvuVhxWyQTb4k9o0Bi5PREUzuw/tgC2Gh0c+d+8 GlK5gbPGWCbNi9HU0hnMeGsrfE3R6kWMKt4/zKTTteZQly7ZczkyxP/dYviSJQ/oOTvv x8137kd7+uIUAJW7atc0AKk2qkD2XLRDcv8hEkJEM9ECJ8e5k9uP74CQBsH0pdAzzrnu R4hYifgepy2oxe4q8gbF266CxQR9c0b/tGg81w6gxRkHIIkl/PF+PkvpsqVImeIqIHW8 DiRg== X-Received: by 10.202.80.199 with SMTP id e190mr18327325oib.14.1421691905854; Mon, 19 Jan 2015 10:25:05 -0800 (PST) Received: from [192.168.2.145] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id fi4sm6200861obb.16.2015.01.19.10.25.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jan 2015 10:25:05 -0800 (PST) Message-ID: <54BD4BF6.8080502@gmail.com> Date: Mon, 19 Jan 2015 10:24:54 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Nikita Popov , Andrea Faulds CC: PHP internals References: <53F8A1FF-C809-4DDF-9C6F-6916C3E4F044@ajf.me> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Combined Comparison (Spaceship) Operator From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > The operator is also less clear ... if I see "$a <=> $b" and do not happen > to be familiar with another language implementing this operator, I won't That can be said about every syntax construct - if you never seen it before, you'd have to learn. <=> is used in Perl, Ruby and Groovy - so it's not exactly unknown thing we've just invented, and if you've seen it once, you'd never forget what it means. It has the form that perfectly describes its function, so there's no real confusion here. > have any idea what it does (the closest thing <=> 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. So instead of $a <=> $b, you'd get something like \PHP\compare_function($a, $b) or maybe even \PHP\Ordering\compare_function? I don't think most people would prefer the latter. Operators exist for a reason, and comparison is a frequent enough case to make operator - especially one that has a long tradition in other scripting languages - warranted. -- Stas Malyshev smalyshev@gmail.com