Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96035 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32136 invoked from network); 20 Sep 2016 12:58:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2016 12:58:29 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; 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: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:36102] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/96-19521-47231E75 for ; Tue, 20 Sep 2016 08:58:29 -0400 Received: by mail-wm0-f49.google.com with SMTP id w84so132697326wmg.1 for ; Tue, 20 Sep 2016 05:58:28 -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:subject:from:date:to:message-id; bh=CGcMRTh8+t76rsiKKUg5BKtPJm63SibhvYQzrvk+sXs=; b=EHpPA5dzsthMygwG+hwtIjD6vg0z3I55uZYgkIhyhPxRTZmFieiW3jKOr3mydtMGvV rBbzgr7/c093+GvePRN0x/5SIhyDTv3LiKgVZ2VPFUeW3b5+o9RY6KPgwvtsnatqVQfJ Q0GHsccV9yXbpC43YGHFSP8InTJQsJOaEGJWDwQMVMr0/ev3jMA5tIn/PRwpR1nHPAni KZ3XKl6Bpeej5t2Lt0mv79ZVKQ1b8dm/RuauwZROzWftZdBS4pYjieSVvyiLJoASMFBE p0/46yX7M+rTeCBCftYXFuzIKFBnSe3P1pBzhAlUAEU+dexrjjlZX4H1p30mHfu+oxSD hn9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:from:date:to:message-id; bh=CGcMRTh8+t76rsiKKUg5BKtPJm63SibhvYQzrvk+sXs=; b=Ms81EXOd8itNUFKo216i1alU2o9OMVlKwK2dARuMf7Sn/9HBZwv2E/lSuU5KM+z6Wv O01tn0l9caIbZHLqsOee/QvMdhkDLjqgvAMiD2r39Ocdq6wEdYYU0M9Y0Zwu0u6KECAH vS+bCJQU/bcvJkrTTJ5RCHJsS6ZkEmxT+wZbK/eDsYY6Xj26MYKQ05iyD84qz341u2KH aQUmgiZbqr+iuzbJezhnt5WeN161C+p7eluo4KLPeNzy2xt5ZpV4xfao3qpdt5cUKing x2gAqg6ycpFgKCwePgO9oa6nTVZEcYhDi8JxU4NDCStCNkkOgpMUiHOzki5APp1JZIDV nXXA== X-Gm-Message-State: AE9vXwPhuqslUE/cRNFBwaqlRPP6DnHQ9S6J9bOaEuL4JE/ZNofIyqs5m+RaVeFXNFK1TQ== X-Received: by 10.194.188.113 with SMTP id fz17mr33159450wjc.179.1474376305285; Tue, 20 Sep 2016 05:58:25 -0700 (PDT) Received: from [10.61.221.135] (188.29.165.182.threembb.co.uk. [188.29.165.182]) by smtp.gmail.com with ESMTPSA id md9sm28340963wjb.20.2016.09.20.05.58.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Sep 2016 05:58:24 -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: Tue, 20 Sep 2016 13:58:20 +0100 To: Vesa Kaihlavirta ,internals@lists.php.net Message-ID: <89582D85-954E-4A4B-9319-C63A3A24F30E@gmail.com> Subject: Re: [PHP-DEV] RFC: Strict comparisons From: rowan.collins@gmail.com (Rowan Collins) On 19 September 2016 14:04:48 BST, Vesa Kaihlavirta wrote: >My idea is to add a strict_comparisons declaration that you can add at >the >beginning of a file in the same way as strict_types. The effect would >be >that all normal comparisons would make a type check before doing the >actual >comparison, and throw a TypeError exception if the types don't match. Hm, that's definitely an interesting idea. It occurs to me that there are a few things to "being strict" beyond type equality. For instance === will also (I think) stop PHP juggling *both sides* of a comparison, e.g. two numeric strings will sometimes be compared numerically rather than bytewise. Using if statements with non-booleans also feels closely related - should the setting (or another new flag?) throw an error on if($foo) being implicitly processed as if(empty($foo))? Regards, -- Rowan Collins [IMSoP]