Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123668 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id C2BD41A009C for ; Tue, 18 Jun 2024 20:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718743441; bh=GoB7M8hsFbrcNcoy9fOr9mI1ydOWVYQipCu3zklelUs=; h=Date:Subject:To:References:From:In-Reply-To:From; b=FijQ1ReOWXo5tWjk5plfrFvt2pthLbTPWTEv0HhhXkfYNI39CfQoCz19Y4CUOSCLK hmceJsr4oEdqBbpKvSCOAjZ2EpDeTOmzda38WoTx8imUjcHidSLaIphuWA/XIy84vW sNp+PhMZxcjqNkAYBYUyQwr53tL/JKWVOK9c5nD5/3e2vjukAIO0T65L9JtXGHG073 e5eSrrflSmP1GehYAColEWI6DFX7SaOw8/4UPUBK0Gix2QDDdx2MQGB4nwoygKBQIN rf6hS1CUsIl2vqVAzS3tDbdATvR9pzQ9wewdQXuaviy2jmw02uFq0pCmtEsW1rzvIT AEvWCMVXAF3Vg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D6814180077 for ; Tue, 18 Jun 2024 20:43:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh3-smtp.messagingengine.com (fhigh3-smtp.messagingengine.com [103.168.172.154]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 18 Jun 2024 20:43:57 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 13D96114005D for ; Tue, 18 Jun 2024 16:42:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 18 Jun 2024 16:42:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1718743364; x=1718829764; bh=d6NS1uHKBO 6AyaY+fLecniEao6Y8EAPmzieY83zkWvI=; b=CZNThVM0WhB3J0yBSMs96puUcA wg50ZWxWB4sX2w1S5kVaIyq1yDnhZQ3337J1W/S/lOk5D/ByWXVkG7+qD5nBYuTa z2sm8l7i0FFHulKGBO6R8Y9ghiOsCDL//7IA+DkWr0QHOVxuBRt4/kj2WNRrOTxl shPc7vGqse5oASU5EJ4mBNEkHGHwKeVKm6ZqD8wsmVpm2GiGlQPgzRXYL9ypSK+Z fE4iVVY1QHrdM5ay2DsXTDoAQocNZM08Ll6Rq5DbMSrQiYdxHRI/JyvfTQowWAVW B1vz5JdDlxbZJKYqV/dPQMBtyRG3Bw/UTKpViW7EHbk4a4KzH4LRfbc74haw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1718743364; x=1718829764; bh=d6NS1uHKBO6AyaY+fLecniEao6Y8 EAPmzieY83zkWvI=; b=RkrmMAQdOl1tZou/AWJqRJwZYjcOPGb7l2bG5OUCKtXO j9Y4FVDiqntc/psdqZ8PztVCpHhcRqScD4FyTP5RqFbD/d+v5c/bpJHERSIXEDUV E9x1NO5p7fIinGaM1br9NEzOn2finX+AQ8VIidtkUxJkF5s6YFMB50rCiU2bQSKw kEFtRfIOsk3QYt5ytUKHlrXQ8XQJ60mckynIyhZUgkcGZ/3D3pP7CXSkU46e6UoI Ot85EpK7SAs/Q2uSRMrnjhVB6KJBELzKqzN8wlZzh5KiNMFR7qXrWi7YHmEtm7Eo aRtRJ49saSsedCLCJZ5aK5xDg16DrOwL6tUPd7kSfA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvkedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurheptgfkffggfgfuvfhfhfgjsegrtd erredtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdf uceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpe ehteelieeigfeuudeiueeiffdvveehudeufeekjeeugffffedtiedtgeettdelteenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprd hphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 18 Jun 2024 16:42:43 -0400 (EDT) Content-Type: multipart/alternative; boundary="------------cFjwWUsnuRNc4xXwhdpD5eLq" Message-ID: <6b07cb4b-13bc-4e63-8834-fc782faab01c@rwec.co.uk> Date: Tue, 18 Jun 2024 21:42:42 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion" To: internals@lists.php.net References: Content-Language: en-GB In-Reply-To: From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") This is a multi-part message in MIME format. --------------cFjwWUsnuRNc4xXwhdpD5eLq Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 18/06/2024 17:37, Robert Landers wrote: > One thing is clear is that "strict types" may be a bit of poor word > choice and gives people a false sense of security that it is "safe" or > "more correct" when this obviously isn't true. I totally agree with this sentiment. I don't think it should be called "strict", and I don't think it should be "on or off" either. If I had a time machine, I'd propose something like: declare(scalar_args=coerce); declare(scalar_args=error); Or perhaps: declare(coerce_scalar_args=if_safe); declare(coerce_scalar_args=never); But... > Thus, I'd like to propose, for PHP 9, simply renaming it... I'm not sure the pain is worth it. We'd have to introduce support gradually, probably not phasing out the old name until 10.0 at the earliest, so you'd just end up with more confusion with people not understanding if they were the same thing, which one to use in which version, etc. > Perhaps it might even be worth adding a secondary vote to flip the > default, such that if you want to "old" behavior back You're falling into the same trap you're describing: assuming that strict_types=0 is an "older" mode, or a "worse" one. Both modes were introduced at exactly the same time, as a direct choice to users between two different styles, which had been proposed in competing RFCs. Changing the default, and the name, but keeping the same behaviour, would just be a huge mess. > Personally, I would rather unify non-strict and strict in some way that makes sense I think this is where we should be focussing our attention. We've had some great RFCs over the last few years tightening up some of the weirder excesses of PHP's type juggling system. With a tight enough definition of "numeric string" and other coercible values, I think "mode 0" could be strict enough that "mode 1" wouldn't feel so necessary. Then again, I was broadly in favour of the original coercive-only proposal for scalar type parameters, and there are those who felt strongly on the other side. The debate was extremely heated, and I'm not in a hurry to reopen it. Regards, -- Rowan Tommins [IMSoP] --------------cFjwWUsnuRNc4xXwhdpD5eLq Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 18/06/2024 17:37, Robert Landers wrote:
One thing is clear is that "strict types" may be a bit of poor word
choice and gives people a false sense of security that it is "safe" or
"more correct" when this obviously isn't true.


I totally agree with this sentiment. I don't think it should be called "strict", and I don't think it should be "on or off" either.

If I had a time machine, I'd propose something like:

declare(scalar_args=coerce);
declare(scalar_args=error);

Or perhaps:

declare(coerce_scalar_args=if_safe);
declare(coerce_scalar_args=never);



But...


Thus, I'd like to propose, for PHP 9, simply renaming it...


I'm not sure the pain is worth it. We'd have to introduce support gradually, probably not phasing out the old name until 10.0 at the earliest, so you'd just end up with more confusion with people not understanding if they were the same thing, which one to use in which version, etc.


Perhaps it might even be worth adding a secondary vote to flip the
default, such that if you want to "old" behavior back


You're falling into the same trap you're describing: assuming that strict_types=0 is an "older" mode, or a "worse" one. Both modes were introduced at exactly the same time, as a direct choice to users between two different styles, which had been proposed in competing RFCs.

Changing the default, and the name, but keeping the same behaviour, would just be a huge mess.


Personally, I would rather unify non-strict and strict in some way that makes sense


I think this is where we should be focussing our attention. We've had some great RFCs over the last few years tightening up some of the weirder excesses of PHP's type juggling system.

With a tight enough definition of "numeric string" and other coercible values, I think "mode 0" could be strict enough that "mode 1" wouldn't feel so necessary.

Then again, I was broadly in favour of the original coercive-only proposal for scalar type parameters, and there are those who felt strongly on the other side. The debate was extremely heated, and I'm not in a hurry to reopen it.


Regards,

-- 
Rowan Tommins
[IMSoP]
--------------cFjwWUsnuRNc4xXwhdpD5eLq--