Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118079 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 11343 invoked from network); 24 Jun 2022 09:15:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jun 2022 09:15:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 70574180211 for ; Fri, 24 Jun 2022 04:05:27 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 24 Jun 2022 04:05:26 -0700 (PDT) Received: by mail-yb1-f176.google.com with SMTP id d5so3911706yba.5 for ; Fri, 24 Jun 2022 04:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=rqAsxZQP8/cV6i99ZBIDxzzn+BDNpbHCSTYevAHEP+Y=; b=TZ3FWDR3p9aejCrq/Soyb4yKxu4IdqSBNYsQV5XnQtqeQvBZGjgpF1EOcNdX4qGxcO LBiVRNFERVvhpSGwoT3PCV1SnGpiA4d/QIFSksEf2IZKM6+wvZi/WeK8aNXwOHD+gT7E kAkbdynuR89MDBF/3cEp0Ip+onqN+GoWlij7tTmoK6DPMDaiDzoWR0S8NwXlICqW1SBV ygEfMDllRZPsIGufQO1o6ibJTNlwgtP58SbwUXbUXovhW47xplmWL88+KWHmQ6xu0p9l 1QLkayabWB+6nyyCR9f0/J8gnZgoJ6Z6pFcaB4MOsfNDztldJOPlO9k/XuS+H3IkGFe+ OlFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=rqAsxZQP8/cV6i99ZBIDxzzn+BDNpbHCSTYevAHEP+Y=; b=7vLdHVwX7sGdBs1LmQTP0mw2N1xVOM4xqW0lt7kkInveVmuez1+fSRtN0qGvDaxyu/ B+46TZCzLF6XqqjRlDzSlc1nZjrUwvzrlDsklgE8jJBwfTzXf+9JREyDd9e4+Sbckatw 02JNAE+WIa/Jvn1OW9ryBjw/s7BiHbCqRVKuTKlNiUMcEtiA5ODOGiyGnCmibpa1H7wW cZV0N42fDmG/Z01TFd592r1i8eu0LjEpk08VJ/svSEQu1+EdoM58cXlU9g+ygUu62l1R 2PsNY6CuI4azQhibmDbo4MNN6NT1Jmp306fkVwlUaJAAAdONmHRnZamuRK3li8IVP3Ly 7UVw== X-Gm-Message-State: AJIora+6OASFejeQ5HR+7Ylvy6PRqMz/eaKsleniUkjqQumCYfRmvSN2 joSohskIzTKIvrUXSWHJthRnNPJv/uWBEBJ9ln91f4F8DQ== X-Google-Smtp-Source: AGRyM1s72BaJ4SwFGoxj6SH5CnbpwGtZHz7sOpET8OtTlRBJkP8AF0jYIrnKFZJxKPq5mMcME2fnhTJMU63rLql06YE= X-Received: by 2002:a25:a282:0:b0:669:b4d5:49fe with SMTP id c2-20020a25a282000000b00669b4d549femr6198799ybi.14.1656068726366; Fri, 24 Jun 2022 04:05:26 -0700 (PDT) MIME-Version: 1.0 References: <28886d77-2c48-5196-d35b-b15419c3bc13@gmx.net> <69ee260d-cade-943f-1ec9-98296cd29b06@gmx.net> In-Reply-To: <69ee260d-cade-943f-1ec9-98296cd29b06@gmx.net> Date: Fri, 24 Jun 2022 13:05:15 +0200 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [VOTE] Stricter implicit boolean coercions From: guilliam.xavier@gmail.com (Guilliam Xavier) > It would have been interesting to get some more feedback on why people > voted No - some took part in the discussion, but most didn't. Indeed... Of those who did, I have retained the following arguments (sorry in advance for any omission, approximation or misinterpretation): - no impact analysis (but seems difficult...) - it would increase the discrepancy between e.g. `if ($x)` and `takes_bool($x)` (already existing for non-scalar $x [okay VS TypeError], but now for scalar $x too [okay VS deprecation notice]) - the deprecation should apply to all floats (even 0.0 and 1.0) because floating-point equality is risky - the deprecation should include the string "0" (VS empty "") because it's a recurrent WTF (and maybe even in all implicit boolean evaluations [e.g. `if`, `&&` etc.] too) - we should rather deprecate `takes_bool($string)` and `takes_bool($float)` totally (i.e. all strings and floats), and also `takes_string($bool)` and `takes_float($bool)` (but maybe don't need to change `takes_bool($int)` at all) Note: I think that generally there can be arguments in both ways... > I think the RFC would have helped > identify obvious bugs I agree ;( > thanks to everybody who took part in the discussion, it was an > interesting experience. Thank you ;) > If anybody still wants to give some insight on these reasons or a way to > improve boolean coercions in another way, I would be happy to hear it. Sorry I don't have better ideas... Maybe others will? -- Guilliam Xavier