Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124685 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 6C0861A00B7 for ; Tue, 30 Jul 2024 12:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722342757; bh=YCmfgkp6b275MZl3ZUnzLtQzHur2q25GAVNREYN3LKo=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=UAd/nhcw9xFovuO6F1Gfno4vzwP/bKHZNQQXttjLLBcnp3YAVvyiDxXHbRCUhl+O5 SC6jUK7W7SlXjqv2ndl+MAzT6C2X9Wc/RP7bBe9fDsaYFECl3VGdPYBdGiNgkGBwGO D0bIM1Mv5Y6qmykkew1JwCxddjUTY5Z4b1PksRM0nB/cr+ic+OLydEb9PCAhAJDqLh SvJAfaDEgI5lZzInnGzzaMW8eQNOBMhdl3+1K7nD668FW1FtE2NW1ltwezZGcD7bWF yxA18FjDR2a0vIRRW3O9bOhEY4sK7ddLZRHxRMij/B8FpeApxaHQrALTIvdyR/gi0f 4G1GuLfBKiRIg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D4B12180042 for ; Tue, 30 Jul 2024 12:32:35 +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_PASS,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) (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, 30 Jul 2024 12:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail2; t=1722342655; x=1722601855; bh=YCmfgkp6b275MZl3ZUnzLtQzHur2q25GAVNREYN3LKo=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=XZWrsfUS69SvfjN7sGgPk4w/eykRQf4jLl8MALm2GQDVP7hsG7xkImi3+j/QG7fTd FydTS0DW/sFuLX8ilqs1T0MV1bMmlpbhCA0iTbOax0YgPUDHxqd4rCMj0CLBg3LsSS m7gbP8T+R0ix7MkQayGj7cikXWVTGv63xetC3sMGdz04bhdpFkdsAQ2yBRSmR7Rl3P tND5gIsdBa4MzGGs+Fr1xB3iIgYgB8y7lHe9S1ddj/nFVieY3OcGhasmXbmwB6TQqo qo4OoUwUSYjTS8pA/4PQviQ4JggWr5E6hF+IJOqxUm39Trde+jhBOgf+p45BPeArja p752rtIuadARw== Date: Tue, 30 Jul 2024 12:30:50 +0000 To: "Christoph M. Becker" Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] [VOTE] Transform exit() from a language construct into a standard function Message-ID: In-Reply-To: <15bb76a0-cbd7-4145-b429-76d424755106@gmx.de> References: <15bb76a0-cbd7-4145-b429-76d424755106@gmx.de> Feedback-ID: 96993444:user:proton X-Pm-Message-ID: de2b39ec3e11c653cfb9e89e5b91530b0cc9f765 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: internals@gpb.moe ("Gina P. Banyard") On Tuesday, 30 July 2024 at 13:47, Christoph M. Becker = wrote: > Hi Gina! >=20 > On 30.07.2024 at 11:49, Gina P. Banyard wrote: >=20 > > I have just opened the vote for the "Transform exit() from a language c= onstruct into a standard function" RFC: > > https://wiki.php.net/rfc/exit-as-function > >=20 > > The vote will last for two weeks until the 13th of August 2024. >=20 >=20 > As userland PHP developer, I always regarded `exit` as a control flow > instruction (quite similar to `break`), and as such I'm not really in > favor of converting it to a proper function (especially since it is not, > because the parantheses could be omitted). You are not the first person to mention this. I don't have any plans on doing anything else to exit, but I never really c= onsidered it to be a control flow instruction, but that is maybe just me. >=20 > Would that RFC imply that I would need to write `\\exit` or have a `use e= xit` clause to avoid dynamic namespace lookup? If so, I would be even > less in favor of that change. No, since the new implementation where the token is preserved this is not n= eeded. You cannot define the function in a namespace, nor disable it, nor use it a= s a goto label. The one benefit of having it become a proper function which can also be use= d as a statement is: - Using named arguments - Passing it to callable parameters - Usual type juggling semantics >=20 > I do understand your point about the type juggling semantics, but I > might have addressed that differently. I almost always use `exit` > without argument (and if, only with an int), and `die` always with a > string (and only for quick experiments), and I figure that this might be > what most contemporary code does (at least, I hope that the > `do_something() or die()` times have long gone). As such, having `exit` > and `die` as alias could be changed, sticking with `exit` as a control > flow instruction, and having `die` as proper function (which could even > be implemented in userland), where exit would allow an optional int > argument (like `break`), and die() a required string argument. Of > course, this would be a much bigger BC break, but it seems to me the > cleaner solution. This might be a good idea in the long term to properly split exit and die a= nd have them take only integers and string respectively, but I am not going to personally bother with this, even if I think this is = a good idea. Best regards, Gina P. Banyard