Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125321 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 7C0F51A00BD for ; Tue, 27 Aug 2024 14:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724768186; bh=Z+chJTlV6sSEAUne0Yb5IZsssDDV4OoZbQURQqk/HH4=; h=Date:From:To:Subject:In-Reply-To:References:From; b=kRf7F7hq/zzSHCH6JYz/iXcCnPPoitXbzwheG5rNi9mtF4FY40uy8UGCcO1KNEKSM aKNkmL5ZoYSIaS8snj+J4W3vluz7vBsZgxT030A4+K9OHcdUz4aHmLev15T4Jr6Ggp F28I1QSNkUCSjmJ3LHIFH4Kfw0wNXEChfhFjiE/ms0jlgxj1vB89k0htnenT+4XjGi zUIQoQqcu+sb2+aZnOopFqx8UqOX3rHid10JXRPWfU+KI1XrDTYaW0Y0s88g99yRA3 CkoUgvCYm0c5aDM1K2sLFTWsDC1QbGVXs599mvChmHVkQJ94hkBxEuRmrkARBWvdn2 ewkksRJ/E/+4w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DE9FE1801E3 for ; Tue, 27 Aug 2024 14:16:23 +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,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) (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, 27 Aug 2024 14:16:01 +0000 (UTC) Received: from phl-compute-08.internal (phl-compute-08.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id D9E6D138801B; Tue, 27 Aug 2024 10:14:07 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 27 Aug 2024 10:14:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding: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=fm1; t=1724768047; x=1724854447; bh=Z+chJTlV6sSEAUne0Yb5IZsssDDV4OoZbQURQqk/HH4=; b= oithRTiLpcpt6Utu2H384qdArU5ReBSdrzPjZkvOu/4qF8KINCYoldJaALjQy2hQ fMJVJAfaRZmuI/S361j0lgpSJ46aiiZ3+XMHzvhhUWXOP1F6aMq/l0EpQc3rncXG 9OSM6ObTxYuL4okr4F1FuzlB0UPGoNsia9CZ/+XZFIIz/BcyjLqFFpcN8utaRwhG HDvuPPqU/UzOmzeRlriMj+VpCgPdp1fp9aVN5MYUXhoHBna3SLdxx1U/IpdVVPli APME3/spA3gExx6yqbkCD32TC/F3tb40tsvi4uAjJx08MrKGnF3zqcq89S62uDQX K4idKFVp6WA7raLkt3aZCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=fm1; t=1724768047; x= 1724854447; bh=Z+chJTlV6sSEAUne0Yb5IZsssDDV4OoZbQURQqk/HH4=; b=s 4zkoa7/EKrEVG0R3Y3T3nUNeuyOuYQpY3SJ68EB9N5fTLfsEY8xmXII92cw/8KOA 13F30/LZNV691OBFUDtNTKJuvYMlSJX4MXJccyq9zEAvB2W+MImsEEIGR5PWc/XB wNyILwwCz2jYors2G9E3R2tYBRjcJJDrE03WHJw+YgMVgdIhgIekkB4B0987E/vf LTOqVLz71hxjQ1Y7ykQrelxMKoGt1QuzXXfcDXf8u2vfMrSkVsYSAuL7+yTpMLCI d+yTWzrcCHHkruuVldpMj/Rjv22zLYA2nC1e5c2hXvlEiRDoe8g7yE/2ZNd2j2wi JqkDXVH5J4ylX43klg6hw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudeftddgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuf gfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhn shculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenuc ggtffrrghtthgvrhhnpeehleffteeigfevudetfedugedtudevledugeeugeelheeihfeh gfdtkeevvefgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohep vddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhish htshdrphhhphdrnhgvthdprhgtphhtthhopegsihhlghgvsehstghrihhpthhfuhhsihho nhdrtghomh X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 27 Aug 2024 10:14:07 -0400 (EDT) Date: Tue, 27 Aug 2024 15:14:04 +0100 To: internals@lists.php.net, Bilge Subject: Re: [PHP-DEV] [RFC] Default expression User-Agent: K-9 Mail for Android In-Reply-To: References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 27 August 2024 14:14:03 BST, Bilge wrote: > Whilst the applications beyond use in conditionals still strikes me as l= imited, it also appears equally harmless=2E=C2=A0 Though the number of peop= le whom feel its use in expression should be limited is steadily growing, I= 'm still waiting on someone to publish an exclusion list with justification= for each exclusion, because again, I think a plurality of possibilities ar= e harmless=2E=20 I'm slightly baffled why you're still looking at it from this angle=2E Pos= sibly, the volume of messages in the thread has made it easy to miss some o= f the points that have been raised=2E There is a fundamental, unavoidable, cost to allowing any expression which= relies on the type or value of the parameter's default not changing in sub= classes or future versions=2E It makes changes that are currently guarantee= d safe by the principles of the language, into compatibility breaks=2E As B= ruce pointed out, it introduces a contravariant output, contrary to the sub= stitution principle, unless we break a bunch of existing use cases by decla= ring parameter defaults invariant=2E You're not going to see any kind of "exclusion list"of operators, because = on closer examination of the impact, we've realised that it's not particula= r operators that are the problem, it's the entire principle of allowing "de= fault" to be evaluated to a value in the middle of an expression=2E The only expressions that are in some sense "safe" are those that can appl= y equally to any possible type that the function could in future set as the= default=2E In theory, that includes a match statement with an arm of "defa= ult =3D> default", e=2Eg=2E json_encode($data, default, match(gettype(default)) { 'int' =3D> default |= JSON_PRETTY_PRINT, default =3D> default }); Apart from being incredibly hard to read, that's not even useful: the aim = is to always enable pretty printing, but the result is "enable pretty print= , unless the type of the default happens to change"=2E So that leaves us with those expressions where "default" is only a result,= not an input:=20 expression ?: default expression ? expression : default=20 expression ? default : expression expression ?? default Unless I've forgotten something, that's it; that's your list of allowed ex= pressions=2E Whether that's possible to enforce, in the parser, the compiler, or the ex= ecutor, I don't know=2E But if it's not, my opinion is that the entire feat= ure has an unanticipated problem that makes it unworkable=2E It would be a = shame, because on the face of it I can see the value, but sometimes you jus= t hit a dead end and have to turn back=2E Regards, Rowan Tommins [IMSoP]