Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86679 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92754 invoked from network); 15 Jun 2015 20:47:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jun 2015 20:47:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.45 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.45 mail-wg0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:33760] helo=mail-wg0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/22-15639-CC93F755 for ; Mon, 15 Jun 2015 16:47:09 -0400 Received: by wgez8 with SMTP id z8so78164717wge.0 for ; Mon, 15 Jun 2015 13:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to :message-id; bh=dgQ8VTrtYNN7EceDsuObZby8Yv7OjNv1UxeK3fFvwKA=; b=tC0RWDKzAKcoxdVB0YRSgul70RbIn2diaOvI+seg05alTOiufLmCFxiolzbd52KKQ5 Wh9rWLb/gqPpopua5maH9PdUXx6e/SkjKxIQ8BX3TgL6vtBZYKfncotEWnsDD+53/+eF IVOnNOwThKpf8+jU5u5FBk787Mn5X0dqyKvxDcAGD+SS/jXx/npai4GmEN/hB/O0nV1J Db1g1ojFEPfY/4JX1Q1MQboFiAy513eZ/dTqgqhKRsx6fEgRWygJUT4I4Ga6P9vAAoq+ AuHwaKDDdRKPW1LPTc3rfszyDH7CUmcc1WGWKe33RonyEP9b7r4L933JxlRzuoY9kcPa 20vQ== X-Received: by 10.180.104.197 with SMTP id gg5mr35362595wib.27.1434401226162; Mon, 15 Jun 2015 13:47:06 -0700 (PDT) Received: from [192.168.0.6] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id be3sm17542248wib.21.2015.06.15.13.47.04 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Jun 2015 13:47:05 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Mon, 15 Jun 2015 21:45:53 +0100 To: PHP Internals Message-ID: <06AFCBA8-CEB0-4AC1-BB72-ACA6213F4334@gmail.com> Subject: Re: [PHP-DEV] Spaceship and NaNs From: rowan.collins@gmail.com (Rowan Collins) On 15 June 2015 20:55:04 BST, Bob Weinand wrote: >As far as I know, we made it that way in order to enforce an int return >type all the time. >int(-1) is indeed the sensible value for this. (Mainly int(0) does not >work because it'd mean equality and so we're left with int(-1) and >int(1).) > >Just because other comparison ops already return a bool, we can return >bool(false) there. This makes a lot of sense. If it returned false, that would just be cast to 0 in most situations, implying that NaN is equal to everything (rather than nothing). In other situations, it would simply lead to an error. The operator would lose much of its value if it had to be surrounded with error traps and caveats because it didn't reliably return an integer. Regards, -- Rowan Collins [IMSoP]