Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123696 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 A32451A009C for ; Thu, 20 Jun 2024 14:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1718892390; bh=96n/uu0uqv6bs2WELXfi+tfWxQ6HoJ/iyCQ1mTC9WfY=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=eS5At/ywJeeVLAmJqfzjFgYhAywwZHKuXbkYskXkIf6zZ+sLLFfFBElI+vgJqLiqb CysmVvDQAx3InGT09L2njcwfP4gHGb2pwJ0OcX65s67vDjfosZfIXLkx0O+x1TN8Er f5UylpFg3GCP+x4Zz3Ww4LtswmQ9k69H+5kl8HRudQvWqKM/csWgNyo2vslJyJzUUG xwWljlOaNKmislCLNdNaruVfyhbk0nxxmuSGVJTQIR982wUljKE9Cq0RVbd18ZxCCP Gh4ouLBm4CNMNALVObMS/kAlurN0nfGmpxx76GNaIAXxbvvFrbHvROA8bmyq0Zf81f 12dbW4PZIVCBQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 78B9918007F for ; Thu, 20 Jun 2024 14:06:29 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,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=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 mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 ; Thu, 20 Jun 2024 14:06:28 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-57cfe600cbeso1076970a12.2 for ; Thu, 20 Jun 2024 07:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718892314; x=1719497114; darn=lists.php.net; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HJQQIgmwcX/yX744HkoVVItoaUN1fMjl+09EHLM9QJo=; b=UmZd1AbJvknFmABhgBpduXZ18PXxB/aFPNJpyU1Rig9E1sjBRXXqVjRRIvFn5TYyJJ zV6XYh1X2AIVN1Zz21aNn3ul79Ot2j/WCPaVAsZhoaZ4qDPZXWspOucVreJT5ldXETA+ Vdfkx7wI2n2QbQxHVdhCAdUYJ3f4FdFQnGCH+FSxlMlQNX58dasw2SNH613bgltnsTCG PZukzuN/vn0QB/kz79Zirwls4CCM0g+4dTj9bfSo+yNyM+/xCukqaC2TcVsrda2RmBB1 O3e7q+obIXGPl3rGVYlqoyY1pD3wP9IhBQJUKDv1X6yaZblFzbE+YUapJ3DHRR1gDOq1 mh6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718892314; x=1719497114; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HJQQIgmwcX/yX744HkoVVItoaUN1fMjl+09EHLM9QJo=; b=tEPMaIgk2vXjhXKrBOITjW5Vjy10YcYNIFLpnAKWxocy54ZBCsCmu/R6zMA4JYf1fJ lZZh31CLD2xgsZ256qTpfKLy5S5eJ5GmnziYIwknVPHYru23FtQ19vh9jqqfrdmIoJuC we8in8nBDKaL/ZMfOoeeaSR+QFwdXnOyb0eCT/GwDkhX5lJck5t5fApbRznP9NksI2Ci vaQ8+qIcSi+oj8f2I8Y2UK73bATSH3mGSfx81Coq9/lk/rRniWVyhwoS/vvN9fhWVPhu iEl+4n9U6I566d++tlLzpIHwe9l/J16Hr7oCNezpwryv39uej+m9gotdGNNi0W+GuQHo 0bVQ== X-Gm-Message-State: AOJu0Yy3guL8+mFoyq89AwQWaRCQfQo/Pqcs7+u4nu2P5PIaE8iBypw0 aP6hR3izZ0+ljSl1YGZaDl5ZDb90UilfMF9Z4/nLx/Y5JjXcvMwZwcGsoA== X-Google-Smtp-Source: AGHT+IEKYwxOLQ0mUQFxOjLCmghGbFabzhBdV8gKJP58Y5xZ2a7KKRTgHop997BuhXsUHCXIcF5ocw== X-Received: by 2002:a17:907:1686:b0:a6f:b428:30fa with SMTP id a640c23a62f3a-a6fb4283167mr319375166b.59.1718892312092; Thu, 20 Jun 2024 07:05:12 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f638d97fdsm684881566b.145.2024.06.20.07.05.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2024 07:05:10 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion" In-Reply-To: Date: Thu, 20 Jun 2024 16:04:57 +0200 Cc: internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <9d28c9tOCChpWUcP1SFiFwtf2-w2XAtDzHsmM73myA7zfBsn7TxxEqs-VCnxRAgZjsk2TxS55owmM8wSLgBQL8LgeQLntUQ9toeLMkjTVx4=@gpb.moe> To: Vincent de Lau X-Mailer: Apple Mail (2.3774.600.62) From: claude.pache@gmail.com (Claude Pache) > Le 20 juin 2024 =C3=A0 13:08, Vincent de Lau a = =C3=A9crit : >=20 >=20 >=20 > From: Gina P. Banyard > Sent: Wednesday, June 19, 2024 5:08 PM >>=20 >> On Tuesday, 18 June 2024 at 17:37, Robert Landers >> wrote: >>=20 >>> Hello internals, >>>=20 >>> [...] >>>=20 >>> What are your thoughts? >>=20 >> As self-proclaimed leading expert on PHP type juggling. >> That it is a terrible idea with no gains whatsoever. >> Renaming the declare statement does not improve the situation. >>=20 >>> PS. Personally, I would rather unify non-strict and strict in some = way >>> that makes sense ... so, that route sounds nice too. >>=20 >> See my old meta RFC: = https://github.com/Girgias/unify-typing-modes-rfc >>=20 >> It is a somewhat known hot take from mine that I think the = strict_type >> declare statement was a mistake. [1] >> Mainly because it affects barely nothing in regard to the engine. >>=20 >> I have written/co-authored multiple RFCs over the years to make the >> default coercion mode less whack. [2][3][4][5][6][7] >> And my container/offset RFC is in the same vein [8] which lead me = into a >> different rabbit hole then the one I was expecting to explore which = is >> addressing PHP's weird comparison semantics. [9] >>=20 >> Therefore, I would rather we focus on *actually* fixing PHP's = semantics, >> than arguing about changing the name of something that shouldn't = really >> exist in the first place. >=20 > Talking about 'going back in time' and sanitizing type coercion, I = immediately had to think about the rejected 'Coercive Types for Function = Arguments' RFC Zeev created as an alternative to the 'Scalar Type = Declaration' RFC which was ultimately chosen and implemented. >=20 > https://wiki.php.net/rfc/coercive_sth >=20 > It seems that parts of what that RFC suggested have been implemented = over time. In retrospect maybe this should have been the direction? Hi, The RFC you are pointing to was about introducing a new, more = restrictive (and saner) set of automatic coercion rules in the context = of function arguments *only*. For instance, `substr('xy', 1.2)` would = have been deprecated, but `3 % 1.2` and `['x', 'y'][1.2]` would have = continued to =E2=80=9Cwork=E2=80=9D (for some stretchy definition of = =E2=80=9Cwork=E2=80=9D). What has been implemented over time, is making the existing set of = automatic coercion rules more restrictive (and saner) in *all* contexts. = For instance, all of `substr('xy', 1.2)`, `3 % 1.2` and `['x', = 'y'][1.2]` are deprecated. =E2=80=94Claude