Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125889 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 38D211A00BD for ; Fri, 1 Nov 2024 16:09:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730477505; bh=k6dRToztZS0hB9Q5OZCGwnDv7sMrgzF3otS1RQAzdY4=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=Nq+rMscfELItOkZ2WE+YWBR4QdT8BAl9tNNjZ/GXsdho8bUN8qEw7WSvvTFLz1LHy TeR6hWXo8ElRHlDDIS2/7mBAmKiBrxdNPcdIDsi3m4mhhOfPZu55TGB1eQdADthpqb NyfZ74LJP0qV4rtaNkOkHNA1oDXVkRbNT8awsMgDi/+VMfDMmi5+Vxh1E7s9ei40Qm jM2x+A8v/69gYLY53sF5Freijh081gDxKOnCi6OXAMYySPcXpZo8WTVqd5zG/zq5Ow g1r/JayjivaZZ5OfYIp0hvZ5KNZG1fRY/Eo7Dsew7mJz3Cg5+7u/saXGPdKS/yDEwL EiFs3csJ1CD7Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8CA8D18006C for ; Fri, 1 Nov 2024 16:11:44 +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.9 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, 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 fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 ; Fri, 1 Nov 2024 16:11:43 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 9172B1380288; Fri, 1 Nov 2024 12:09:13 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-01.internal (MEProxy); Fri, 01 Nov 2024 12:09:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=fm1; t=1730477353; x= 1730563753; bh=k6dRToztZS0hB9Q5OZCGwnDv7sMrgzF3otS1RQAzdY4=; b=p pdz1WqOkeUtSN2v+BBdlUVkHCrY7aU93WPr9ahtwixshIulwwbD3P1ZPQwMb84Tq XLUQNdpREIc1ZMFwrisxj+HWPpbPICtp4GfAG2qgBVFJQxtM0wzj3zTCCPVxlQAk K1iRVCgipSFrwDVAJgwQjCb07QVHRX5USViOysa4W6XmIOD/FgE5I9Ae51JVLkAl n6DGdkfFUT0/rz6G3ceg635DCzqKYXAEGO4uDCJvtcMBlQ8tRLQCO9xo0zRvmFGX j7cwBeEHIqmm6IYyBFtYkROdLFaiXYOSsMsyy8TzgI39mv+CrCz/xtdlS+MHudnN YrINGyY3sCknHn7fGQrPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1730477353; x=1730563753; bh=k6dRToztZS0hB9Q5OZCGwnDv7sMrgzF3otS 1RQAzdY4=; b=Dz9kMmcNDwFVfYgPkbUZyKOZpSc5eXXZmM6hPJXh4CatRUMmK/j FA0mp1NKs+EmlK8tAYQQianQ1a2K3mcJ730tMGBMhyfoEossky0oe1SPHaZAmzXG xZJLonsFQ+EBLCkhwG3KobMuCTBAY3ZbFC6Pt3GQfe/Zlxqd5g/LRnNkMjGSd9mx UesHFTigAqEl13rxO8aTfK6wKLqTCZWmZgMWAXxyYJCW3VlF9JRp8/ZSLmeSj9tk /Og3jyMHs6NGP7PJzW4peRA7N7WgqfaCbcO7pbVfhRbfOV8MJaimfKFMd02KdKul 7VuK+3e/ChkbfLvYQYDaGOQTqOWlUn5OrSg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekledgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffoh hmrghinhculdegledmnecujfgurhepofggfffhvfevkfgjfhfutgesrgdtreerredtjeen ucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurdgtoh guvghsqeenucggtffrrghtthgvrhhnpefhveetveeuhfejiedthefhveegvddvgfdujeev udekfffhhedvgfffgedvleefffenucffohhmrghinhepfehvgehlrdhorhhgnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothht lhgvugdrtghouggvshdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlshesghhpsgdrmhhovgdprhgtphhtthhopehinhht vghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id D975D780068; Fri, 1 Nov 2024 12:09:12 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 01 Nov 2024 17:08:52 +0100 To: "Gina P. Banyard" Cc: internals@lists.php.net Message-ID: In-Reply-To: References: <15da4c13445d7e9c9d768c60c19768d4@bastelstu.be> <3b458165-406c-4b70-97bc-6e98d6c44c72@app.fastmail.com> <6f39dce9e6b0579baa51bc84cb8140b9@bastelstu.be> Subject: Re: [PHP-DEV] RFC: Support Closures in constant expressions Content-Type: multipart/alternative; boundary=03950c0b44894ffd895157f3104a8b88 From: rob@bottled.codes ("Rob Landers") --03950c0b44894ffd895157f3104a8b88 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Oct 31, 2024, at 15:12, Gina P. Banyard wrote: > On Thursday, 31 October 2024 at 07:22, Rob Landers = wrote: >=20 >> To be honest, I thought it was a rhetorical question since the exampl= e is a runtime error (passing string to a function that takes an array),= but on this note, we already know how it should behave: https://3v4l.or= g/RC6b3 because, as you said, it is captured by value. In theory, to sup= port this, we would probably need =E2=80=9Clate binding constants=E2=80=9D= or constants that are executed just before any userland code is run. Si= milar to just emulating it yourself: https://3v4l.org/PMY4W >>=20 >> IMHO, the rules around constant expressions are not sound and feel ar= bitrary when you run into them. They are too easy to work around (though= cumbersome) and the code still works, which seems to prove their arbitr= ary nature. >=20 > define() does not produce "true" constants and has always allowed to d= efine constants at run-time where there is more information available. >=20 > const expressions have *always* been about determining and defining co= nstants at compile time so they can be put in SHM. > Which is why the const keyword exist. > (and yes I know define() expression that are const expression are "tru= e compile time constants") >=20 > Best regards, >=20 > Gina P. Banyard Hey Gina, I was mostly referring to the comment that we can't define the expected = behavior, not necessarily what is a "true constant" or not. =E2=80=94 Rob --03950c0b44894ffd895157f3104a8b88 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Thu, Oct 31,= 2024, at 15:12, Gina P. Banyard wrote:
On Thurs= day, 31 October 2024 at 07:22, Rob Landers <rob@bottled.codes> wro= te:

To be honest, I thought it was a rhetorical question si= nce the example is a runtime error (passing string to a function that ta= kes an array), but on this note, we already know how it should behave:&n= bsp;https://3v4l.org/RC6b3 because, as you sa= id, it is captured by value. In theory, to support this, we would probab= ly need =E2=80=9Clate binding constants=E2=80=9D or constants that are e= xecuted just before any userland code is run. Similar to just emulating = it yourself: https://3v4l.org/PMY4W
=

IMHO, the rules around constant expressions are not = sound and feel arbitrary when you run into them. They are too easy to wo= rk around (though cumbersome) and the code still works, which seems to p= rove their arbitrary nature.

define()=20=0Adoes not produce "true" constants and has = always allowed to define=20=0Aconstants at run-time where there is more = information available.

const express= ions have *always* been about determining and defining constants at comp= ile time so they can be put in SHM.
Which is why the const= keyword exist.
(and yes I know define() expression that a= re const expression are "true compile time constants")
Best regard= s,
<= br>
Gina P. Banya= rd

=
Hey Gina,

I was mostly referring= to the comment that we can't define the expected behavior, not necessar= ily what is a "true constant" or not.

=E2=80=94 Rob
--03950c0b44894ffd895157f3104a8b88--