Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125908 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 3C4721A00BD for ; Mon, 4 Nov 2024 20:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730752505; bh=aokfDf90J1Ot60+q2vi/MedM+KKNL880Su46y/xILZA=; h=Date:From:To:In-Reply-To:References:Subject:From; b=UQ96iMYOmWamiD1t6fWOB33MYyARKRl8LAeLaoxR33NRD4+3gTIhNV60TklGvC7ho CctaBwhVhTGrvXzvzLgGdNjh2T//LUQRzWqPnpdze/ugJbtma4PGN4Z/Tyrmi3iKyl xE/HQU3ak+yeen6I83S/vk0N1AzUOyzEi5IYTvBXjFFwYAXplfR/s1lNe5Vm9uQVmv 4utd3r7cIA0RvJgdBYR/6E0GxnpdfjAvfHPXLgnPyN++8zRFYIoBh2KuGSJhZiaAle Iimpm2/CBC02TfYeY124jd/dw7DbYWvTIETo+wd7xUZHGnBc7nHhb1qmvVe1nOojEs Crf6D2SOZLznA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7B43C180080 for ; Mon, 4 Nov 2024 20:35:04 +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_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (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 ; Mon, 4 Nov 2024 20:35:03 +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 4E5921380229 for ; Mon, 4 Nov 2024 15:32:32 -0500 (EST) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-01.internal (MEProxy); Mon, 04 Nov 2024 15:32:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; 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=fm3; t=1730752352; x=1730838752; bh=xRZkMLNxFo4gUuU9YmLKf 8nniIqnynVQYB48s24Txg8=; b=SVJ9LccxOo53A2sAIORGf7gFMNWff9gBzz/Th btqvC3s45X0ROwcTJGTiGG+UykU1j8IIJ3t+5W0yuetXtilCWYyZz8Ueg0IK09lX 7qX9rt17M/N3HC161L5i9UYxVV70OatDXOxkIdTyOjdJQGQuT7XuDuPBaw2QQqi0 3S9csy1CyWo2Uiw9f3NCAlSZyy8yGJrIHZbdu2Nk/08EkbGFTUQ62xLbpxIDn6Jy fx5u86jdvoRIZ5NXc0qRZlxqKiMABeZRrzcWYTmrIxHsLg6lUD2EO264LVpCfkLm V+gOLhEDhKvfCsvxZt3J2pvj3PDOVlVec5M2dQz4fi+0zJU8Q== 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-sender :x-me-sender:x-sasl-enc; s=fm3; t=1730752352; x=1730838752; bh=x RZkMLNxFo4gUuU9YmLKf8nniIqnynVQYB48s24Txg8=; b=mGJjCk3YKNgucOYsj owJixgVGoDcGDrDuQaOu+l8+ctd/yI8pEhLu47K0X5rHmJ6ZNh3KnvUz3cVhPOnk 87Z7WqwiMXU/3Guk5nPnWW93Fg8lexkVT2qKFrX/OTCfA3vxEWTKtHK1ZcUF9K8m DHiqnfsDw2MhwPz2l/o/0vjEsSjo0U+SpsDOaa9R3x4n6nAkeCfsfDuwDGyIzNWZ oBB2jrch9dwjtfhwY3MU6EiZrnED75/rYby68mzySw4eNnM6VcIpwwdtjJr1ZscJ csETah2d5NlukdxX9/aopxagmoH6lQ6kEDraXQg/uWPHyJtG0p+fAW2RNqv0pIB0 x7HKA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeliedgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgjfhfutgfgsehtqhertdertdej necuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfh hivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddt geetieeugeevhfetheeffeefteduiedthedtgeejueeinecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgv tghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtph htthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id E80C429C006F; Mon, 4 Nov 2024 15:32:31 -0500 (EST) 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: Mon, 04 Nov 2024 14:32:11 -0600 To: "php internals" Message-ID: <6bffc58a-b869-495e-9be8-0590822e6d79@app.fastmail.com> In-Reply-To: <219e4bbc0b94c35d2410fb640db6c477@bastelstu.be> References: <15da4c13445d7e9c9d768c60c19768d4@bastelstu.be> <3b458165-406c-4b70-97bc-6e98d6c44c72@app.fastmail.com> <6f39dce9e6b0579baa51bc84cb8140b9@bastelstu.be> <219e4bbc0b94c35d2410fb640db6c477@bastelstu.be> Subject: Re: [PHP-DEV] RFC: Support Closures in constant expressions Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Nov 4, 2024, at 6:06 AM, Tim D=C3=BCsterhus wrote: > Hi > > Am 2024-10-31 07:16, schrieb Larry Garfield: >> Hm. It would never occur to me to use a function for a non-class=20 >> constant in the first place, so I don't know. :-) Frankly I can't=20 >> recall the last time I used a non-class constant period. :-) >>=20 >> That said, PHP consts are already a bit squishy, and auto-capture is=20 >> always by value. That wouldn't give us a loophole? > > Here's another brainteaser: > > function foo( > string $bar, > Closure $baz =3D static fn () =3D> $bar, > ) { > var_dump($baz()); > } > > foo('captured'); > > What would you expect the semantics of that script to be? My expectation is that it's confusing, and therefore we should simply di= sallow it. Which roughly translates to detecting if a closure tries to = use an unbound variable statically. Which is probably more difficult th= an I make it sound. :-) >> If it cannot reasonably be done now, but is possible, that should be=20 >> listed in future scope with roughly what it would take for a follow-u= p=20 >> to do. (And then we can argue if it should just be done now, with mo= re=20 >> information as to how much work that is.) > > I have added an entry to the =E2=80=9CFuture Scope=E2=80=9D section. S= ee also my reply=20 > to Alex. > > Best regards > Tim D=C3=BCsterhus Thanks. Can you include what the implementation challenges are for the = future-scope items, to explain why they're being punted to later rather = than addressed now? (As there seems clear interest in having all of the= m.) --Larry Garfield