Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106074 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69446 invoked from network); 26 Jun 2019 14:51:58 -0000 Received: from unknown (HELO mail-io1-f43.google.com) (209.85.166.43) by pb1.pair.com with SMTP; 26 Jun 2019 14:51:58 -0000 Received: by mail-io1-f43.google.com with SMTP id n5so1047698ioc.7 for ; Wed, 26 Jun 2019 05:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=nSag2rcyZPntX+3e/NTpPtdZ4YMCPpK/uPesGCf7Dqw=; b=Zfwjez8NqNQSZDACabD1MKVio99SvyJ+9OpmiP8y/WXm25/LV6JR3QXOAIfn/Ywe37 fY408UtjzMwGtIet8zNqkJq5asQIFSLzJSJF/EM7G53OBMMqgQifXxx5ORFSgJf4oxLU zO9m3QbzdFbux6rmRqk7W+AGhS8X8/uMaOif4RqdmDY8to8mkAlrfsvQx+5e7xJxXyb8 WbzarXIPWyhtY/1iTgK0/rVQ8JKBApkeMl9y+If/T0jtQanN5Jg54TuQZa68AVvOatsy 1lvn7GGYsuS2gBGOjES5W/za22IdPPEfS95OWphLrS8qYt+B2Y3dfKBz6Rcca7drzoHI PQqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=nSag2rcyZPntX+3e/NTpPtdZ4YMCPpK/uPesGCf7Dqw=; b=iVv+vnPL5vxMmLklyUrX8YSGEKN/1Xf8DfOob9ozi5MZHvoU5Um1M9PJoMhM4yxrTF zKpW+PnugXvBxVhYYd8wNF4FDk+Dldnd+82hN12bxeOE0frXeqDuNV6fULB4KYx6k706 2tKamHBNuv3gddH8f8+AKwILqQooapcppU5BEaV/+D26/gZRjhX6YonSBhN9Xdl6KJzo nIp4ti6d/4lnLZQVG5o8jY+ZrNwVySAGDst0eRsB8U411eC7qh1NL8VhqBYTkXpSwST1 msYyuTjhvNJ+msi+Q6NFv5lMm8t31l7voQXU6i/FgH7lDWqTE67cj3Fhcsvv0U+pZakE TWJw== X-Gm-Message-State: APjAAAUjJajxsil5aPQM/9IADnQaJ7noM0x3IfMUSrxSQDzTPgsIgKRW zHqlMHWG83b2cz2ONJ6ClrebJzM7gnGgArSKNbc6gX/ZMjM= X-Google-Smtp-Source: APXvYqyp5VlDTk6rogLmFom9HtBdnIsfexXbKLTcSOYq//lRpfKgiJlqSeNtRB6vkntTyOcEdw+7r4xLYY0csmFCvcE= X-Received: by 2002:a6b:b483:: with SMTP id d125mr812295iof.1.1561550901477; Wed, 26 Jun 2019 05:08:21 -0700 (PDT) MIME-Version: 1.0 References: <6D1026FF-ECF1-4604-91A8-D290D37CC238@cschneid.com> In-Reply-To: Date: Wed, 26 Jun 2019 13:08:10 +0100 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="000000000000c8039f058c38e60b" Subject: Re: [PHP-DEV] [RFC] Strict operators directive From: rowan.collins@gmail.com (Rowan Collins) --000000000000c8039f058c38e60b Content-Type: text/plain; charset="UTF-8" On Wed, 26 Jun 2019 at 12:46, Benjamin Morel wrote: > This makes sense for "<", "<=", ">", ">=", but what about "==" and "!="? > > Currently, "11" == "11.0"; what would this yield under the new proposal? > > - leave it as is: return true in this case => contradicts the whole purpose > of the new proposal > - throw a TypeError when performing the above comparison => not acceptable > either I guess; every language allows == and != on strings, forcing to use > strict comparison operators is a bit weird here. > - change the semantics to return false when both operands are strings, and > don't match => not acceptable to you as you cannot know what a line of code > does without checking the header > Given that we already have === and !==, could the strict mode simply throw an error for *any* use of the non-strict == and != versions? declare(strict_operators=1); var_dump( "11" == "11.0" ); # TypeError: "Cannot use non-strict equality operator in strict operator mode." var_dump( "11" === "11.0"); # bool(false) I'm not sure whether I like the idea or not, but I thought I'd throw it out there as a possibility. Regards, -- Rowan Collins [IMSoP] --000000000000c8039f058c38e60b--