Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123445 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 BBE221A009C for ; Tue, 28 May 2024 12:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716897954; bh=MMnMfvHh3/Jf0ShFvxWUz6dOEs35H5W+CFdCWcnrA2A=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=Kt8oUy7Bsb4ZpRO3M90DXx8NOzF7Sht1F330buTnHomY0KdABV/UNA282+TbPQSXJ 4NYKWtLr3fbzjuT21pg1nHq1hJlItKqHEE6qkw0DN/U5PUMrE/xDJd10rEWNxqtdPz YcXmvYkQwRZ34ubRQwF1nKdQUZJN6pqHc32J4Px18KRLpSBuVZjpmwOrkBEdgCqTU4 Pr8ePfEoL1EAh076HcL2BhIO3j3K3hwLXdRaSih+6gbDGkJPJm5gmAdfafTw7Y1ZBB D9Yi8O2/6XClAFoIulOgbJkOX3w441xmzN7GR0w20girj6aZlbKs9dNqfOtKzNJ95m KELNPowBJnMhg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A046D1806A1 for ; Tue, 28 May 2024 12:05:53 +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,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) (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, 28 May 2024 12:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail; t=1716897891; x=1717157091; bh=MMnMfvHh3/Jf0ShFvxWUz6dOEs35H5W+CFdCWcnrA2A=; 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=hhnRN0fTkT1RpUU1E05xSPrnH+7TKmb+syfFoR/SxPnt+kSj4H8pgVs7PZAxz5ex3 IK+WHs3a7GcylMASo/tM2rudu9Z8Wa6jZP4PV546w3m3xolrxb97MIGUNNvCix/TbI i8CPPIGVGfdVHvrmEUU6GfpMs1ei+k0kPLJ/62oXMau5Ibcc6ygAR5HNyUmxt+VdgV SAo2JaKImkJmJBiRo33UtIlhxTzoPp9NyKc/kJrnKqF2/+FryeBktAU4UXKGozKtgO xfzFw1BA/8rfcHA2OTXTDGZiZyIonlK6x/iXcTy7zrdpAMawDzw/sjW0ZVTrjPYRp4 Qrwm9+HkRfZRw== Date: Tue, 28 May 2024 12:04:48 +0000 To: Claude Pache Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] Transform exit() from a language construct into a standard function Message-ID: In-Reply-To: <43619F54-863D-4D6F-B507-B6256058F4B0@gmail.com> References: <43619F54-863D-4D6F-B507-B6256058F4B0@gmail.com> Feedback-ID: 96993444:user:proton X-Pm-Message-ID: c7a54159aa205b80a863bd08b224bb8bd55f9c2d Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Monday, 27 May 2024 at 19:10, Claude Pache wrot= e: > Hi Gina, >=20 > It is ok, for `exit` to be wired to a function. However, the paren-less `= exit` syntax is absolutely reasonable and should be kept in the long term (= more on this below). It is true that your proposal doesn=E2=80=99t remove t= he paren-less form, but the implementation (a hack around constant evaluati= on) strongly suggests that it is desirable to deprecate it in the future (h= ey, it is even the very first item of the `Future scope` section). Therefor= e, I think it is preferable to keep proper parsing rules for `exit`. >=20 > Now here is why I think that `exit` syntax without parentheses is reasona= ble. For me, `exit` is a control-flow instruction, saying to terminate the = program, just like `return` terminates a function or `break` terminates a l= oop. I don=E2=80=99t care about implementation details, whether it is imple= mented as invoking a never-returning function, or as throwing a hidden exce= ption, or whatever. The fact is, in typical use: >=20 > `php header("Location: /somewhere/else.php"); exit;` >=20 > I would consider an oddity and useless noise to put empty parentheses aft= er a bare `exit`, just as I wouldn=E2=80=99t consider to put empty parenthe= ses after a bare `return`. >=20 > (BTW... I wouldn=E2=80=99t describe a bare `yield` (equivalent to `yield = null`) as =E2=80=9Cconstant=E2=80=9D evaluation, even if it may be found in= same positions as a =E2=80=9Creal=E2=80=9D constant.) >=20 > =E2=80=94Claude Adding something to Future Scope does not mean I will pursue this, this is = just a possible direction that can be done and needs to be argued on its ow= n merits. And frankly I have no intension on pushing this, I would _rather_ remove su= pport for passing strings to exit() than removing the paren-less form. It should be noted that in other programming languages, exit() is a functio= n that requires an argument for the status code. So I don't think of it as a control-flow instruction (because I don't see t= erminating something as control flow) but if that's how you see it fine. If that's the only reason for keeping proper parsing rules, I'm not sure wh= ether that's worthwhile IMHO. Best regards, Gina P. Banyard