Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125877 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 6DA531A00BD for ; Wed, 30 Oct 2024 08:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730277230; bh=jjycI7yxoog3r2RBYgTF1LAYvFQt2E0sw6T1+8ghuzs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ildr3s9OmA1x30JIjfqquuWj2p7oGJTcBebFWv+VW1KqxW5FPn+NlgllDka36PjMK LDFQ1W8hi2oIeAMp9ZgKHq1j5hKDf8Ec6cJ/B64Q+tzGZZojuFys6Gf05iUOTwlVRr zNI6xLwFEeQcB1Z9kScAz8vtk+5kvuNxgS0+zR1e721KwVoyNH0eSwvT1nxzs1s+QE xELryHSjiW/bVTn88FVqx0dxYlc9U4sUCE0CItO/+tlEeDgige/ZKWN8eKx90FC7IX BQGzD2X+OXicebH3ssQEI7N5aHrw3HI39BwWzCNVDdrvoVim+cztYvFYmnT+BjJhRd DTeK4NoHafS4g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D77AA180037 for ; Wed, 30 Oct 2024 08:33:49 +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, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (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 ; Wed, 30 Oct 2024 08:33:49 +0000 (UTC) Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-e2e444e355fso549483276.1 for ; Wed, 30 Oct 2024 01:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730277080; x=1730881880; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fOMu+NhUd/7UFpInL9QSATZBwBOATMUMNSMbbKoEr2s=; b=d4pm3Arr5GjViFd8DOkNCqq5oGiKXQTUlp8DvIYnkNBo8KiHa2WyNHeJKsy4EF7Wvb xWH4+pqhgQ1mKqP15Ab3V58EUq6nZFAh23IgYvfppSAZ6tWJX60yk1DfTaM4XbaLqZFh BpU7BXVgKBmU0LsS31hMUcDyIsHO9Ff5ss40vfv7jY8L62tROhROsKjnuLwHVgnAWa/D z6ezftgSnVrFvfaWuoJw/EXTumyVroSAw+fNCJjk03FD+pvQiLiBPIf1jkyqbLfp7qH2 AqsQ8a4n9ofQnES5gDmeHQWg6fjN13DUYrycPwy7Q2cAGbjJIJBO2X+RbnmTrHiEhxfs +xRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730277080; x=1730881880; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fOMu+NhUd/7UFpInL9QSATZBwBOATMUMNSMbbKoEr2s=; b=v0/fHWo9hPqcJ1TDAtiFY/iKykHDhD5lqKF+99+B+bCaUIj6UwJgYV+Lb76vIPJI57 e/dhMeuWdioY3P0W0kHihQGgzbQKtEvJZ5jVJ4GyrM6shD4d3EkhJsnBt41FvoM0qFu2 7dk9s52hfWCFqHeHcXhyCiVnygZRsiIZ7eu/vG+soasJcAds1lxG/XZMelfJZkAnAMXb /kyktKBuN+lRXuObyNX0nUB+T7frk1ulJwuLpQTk2iyB7URsi2OoCLTtDVq6JbJOw/BY 1ijP949JWiQSe6EG2a/isQlysIEAq5BaB2zxVYQFdeJOJtbf9Sv0H98J9/ka+vfzT1fi WYMg== X-Forwarded-Encrypted: i=1; AJvYcCWf8ln+dfJfM5cWeeNuZYz+BcwZOmZyAQkpwbgTqN8fhCN/Zx4P61MJ6tFwFDXIEwyYKR59/UfNklw=@lists.php.net X-Gm-Message-State: AOJu0YzawImj8sFIobUNBixFYRYdwhKMpOT48pytk4Z67NxLKe5dTTfo pY2pgD3E03+ZqkjVZkSOROB+e0iMnC8X2I/NSwRGq9TpK49N90x303AnEiyF8Gh6BM/mPpzf+uO PYVMC7m4++L4l+qRDklBBc1eZQ385FTtK X-Google-Smtp-Source: AGHT+IE3I4uUq36/3pOIpVDk6G7Lb4DGfkksi9/2tRRqLybj6iQhUzG7cQ7UqVSeSAw7yLuRxcFpKaHzGew0YCKthj0= X-Received: by 2002:a05:6902:228a:b0:e30:ca43:c8b5 with SMTP id 3f1490d57ef6-e30d59a9590mr924091276.28.1730277079928; Wed, 30 Oct 2024 01:31:19 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <15da4c13445d7e9c9d768c60c19768d4@bastelstu.be> <3b458165-406c-4b70-97bc-6e98d6c44c72@app.fastmail.com> <6f39dce9e6b0579baa51bc84cb8140b9@bastelstu.be> In-Reply-To: <6f39dce9e6b0579baa51bc84cb8140b9@bastelstu.be> Date: Wed, 30 Oct 2024 10:31:03 +0200 Message-ID: Subject: Re: [PHP-DEV] RFC: Support Closures in constant expressions To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="000000000000b659540625ad8662" From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000b659540625ad8662 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Oct 30, 2024 at 10:03=E2=80=AFAM Tim D=C3=BCsterhus wrote: > Hi > > Am 2024-10-30 05:25, schrieb Larry Garfield: > > This seems like a good idea to me. My only real question is why we > > need to forbid short-closures. I fully agree that capturing variables > > for such functions doesn't work. What I don't understand is why that > > precludes short-closures. Is it not possible to "just" say "there's > > nothing to even capture in this context, don't try"? (There may be > > technical reasons for that, but I do not know what they are and the RFC > > doesn't say.) > > It would indeed require some special handling to disable the > auto-capturing in the code. This would be solvable of course, but > there's also semantic ambiguity, because users reasonably expect short > closures to perform auto-capturing: > > Hi Tim, So, why not allow capturing, since anyway the only place to capture are constants and static variables? And this way we could have short closures with auto-capture. If there are some technical reasons for not doing that, can we have written in the RFC? Alex --000000000000b659540625ad8662 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Wed, Oct 30, 2024 at 10:03=E2=80=AFAM = Tim D=C3=BCsterhus <tim@bastelstu.be= > wrote:
= Hi

Am 2024-10-30 05:25, schrieb Larry Garfield:
> This seems like a good idea to me.=C2=A0 My only real question is why = we
> need to forbid short-closures.=C2=A0 I fully agree that capturing vari= ables
> for such functions doesn't work.=C2=A0 What I don't understand= is why that
> precludes short-closures.=C2=A0 Is it not possible to "just"= say "there's
> nothing to even capture in this context, don't try"?=C2=A0 (T= here may be
> technical reasons for that, but I do not know what they are and the RF= C
> doesn't say.)

It would indeed require some special handling to disable the
auto-capturing in the code. This would be solvable of course, but
there's also semantic ambiguity, because users reasonably expect short =
closures to perform auto-capturing:


Hi Tim,

So, why not allow capturing, since anyway= the only place to capture are constants and static variables?
An= d this way we could have short closures with auto-capture.
If the= re are some technical reasons for not doing that, can we have=C2=A0written = in the RFC?

Alex
=C2=A0=C2=A0
--000000000000b659540625ad8662--