Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122310 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4434 invoked from network); 6 Feb 2024 19:42:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Feb 2024 19:42:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1707248611; bh=DlwS/cn8A8crIWhbhlKn2xtUQ9DaOjBydZDPrGNtRnU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=eRiQcBzVQ9nR0GjjnNSCiGhJmeIzxkM3bqybkKGcwof1zE9nUAmRoeulEWZpV9P9k fDE9EiaWvMfaC3vHLqOjcRgpAvM0TfjiYNPL+qnqvVd7Z9WLBvjYuX4odL56NlE1dL 0PtGT/oh4dLlTXImVQAz2hgISEPzgW7CB0KL5SqUbRd7cRzeIGDvcmvADHROV2izX/ /3+9/ohTlRIkLDeluXlLV6bWMtQ4qIP1i2wGbNTPuri6IPWZkR4SnORD0nGOle8Myo h72S7q2MNH0u21iJvcsmZaIX2SSYCWabFqu7HOOlIzPprJhACnAoOZNNOmlrQHXPTy 4gZNb2XDhUd7w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DBC5118005A for ; Tue, 6 Feb 2024 11:43:30 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (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, 6 Feb 2024 11:43:24 -0800 (PST) Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-29631796acdso3055786a91.3 for ; Tue, 06 Feb 2024 11:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707248551; x=1707853351; 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=DlwS/cn8A8crIWhbhlKn2xtUQ9DaOjBydZDPrGNtRnU=; b=K/K13uypNsJ+REEi/aJ6hgUc0vOZS6TJ7ycI8cdkb/iuDzMa3HUdJSQNPz0pNA9tgg CGYF3CKPyGlMlVWXCQnPxFdCoga6fMlX/Q48DE/xD/3kpPFTHPMWFBMBIDFMFUiC3xOV oL0vrbXl5ZxKAuHjS0SrZeJeKy03q88LR3nBe4BRoUibn+fKj6QDFjN7p7R3ex1/Je4N mXZfhLDisyGy6xircj62N9AKRS0iVnMl0TWs9gcwlGmUPIHSoXsgKlgcCPRP8AVuvI8x /idIndTM2zZspWQRKAOcpVEghW7PBKX9+EXM2Jt/tKyg81qInl0CggtFSU/D00gqn6BV T34w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707248551; x=1707853351; 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=DlwS/cn8A8crIWhbhlKn2xtUQ9DaOjBydZDPrGNtRnU=; b=Oqrud8gxQAREpxt38Ol1pGnSaNS5mYzO0PFLczhAJ9UlFkVNk0N96LIN04ApEsrc76 cAcQreKJbU+sBTxrwVCtnOFZ/ERja/o/P+ncmsVI72gcNnzmXE7WSGlfM0dXB4Z2KFzo ozb7kJHugisnNeAzhHK2NrEpSc1UVov/GGQBVumIpk3RQYCuuxde1a3rHnYaw4IyGqFR 7CD0EnDabsbsV6VrQBFmj7cVo+lxSVTlsjPUg5Vgghm9traZHS0arbk1xFrxzNkakcQY 9HhMY8JnqbXUcoGTi1XCHzdnxaEJ7/ADH2GESQgHIwHH/DhLhNP4IFvXXicgHn+MTmdH mtOQ== X-Gm-Message-State: AOJu0YwcW2UK8QQLSx4PLd4XM+TZ04asI3z5tzr1LEFVDCRz6ZlKF9s6 2GiuVbBfRN9U5hAgaD/Vb4crg2jMA3Ufb62vRZ3WlKRGjpdZrRbLwGCtcNJrDbBLrREY6PRj0uN sk/pTDL2wyFSG4HSnss/4DCIIOKU= X-Google-Smtp-Source: AGHT+IGVpn1g76PQSfq0CCoO8A7XQrGvAslSNsF4y1pj+oqZMLkGoEYH7qcUVThO5lxVSQR2Bd1MQMNQMOinUTzdcm8= X-Received: by 2002:a17:90b:2cd0:b0:296:ca18:b3db with SMTP id sx16-20020a17090b2cd000b00296ca18b3dbmr603823pjb.0.1707248551125; Tue, 06 Feb 2024 11:42:31 -0800 (PST) MIME-Version: 1.0 References: <742f202d-7990-4f51-b903-7a15e3fd33c2@app.fastmail.com> In-Reply-To: Date: Tue, 6 Feb 2024 11:42:17 -0800 Message-ID: To: Arvids Godjuks Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="0000000000006ee8aa0610bbc752" Subject: Re: [PHP-DEV] Feature request: https://github.com/php/php-src/issues/13301 From: jordan.ledoux@gmail.com (Jordan LeDoux) --0000000000006ee8aa0610bbc752 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 6, 2024 at 11:19=E2=80=AFAM Arvids Godjuks wrote: > On Tue, 6 Feb 2024 at 19:14, Larry Garfield > wrote: > > Thank you Larry for this interesting summary - didn't remember there was > quite a bit a discussion around the topic prior. > > I lean on the "we have exceptions, just leave it be" side out of practica= l > reasons - the vast majority of OO code has standardized around the approa= ch > and interoperability is high. It makes using code that's out there super > easy and predictable - almost nobody uses the "return false|0|-1" out the= re > (at least I haven't used code like that except the PHP's stdlib, and even > that has been changing little by little). It makes error handling > predictable, and considering the type of code we mostly write in PHP - mo= st > of the time we leave the catching to the global top-level handler or > sentry/bugsnag/etc libraries. > Consistency is the word I want to highlight here. For better or for worse= - > it's the method the PHP ecosystem arrived at and it's the predominant one= . > Introducing a distinctly different method of error handling is going to > bring in wrappers around libraries that convert errors to one style or th= e > other, the application code can end up using different ways of error > handling, etc, etc. My approach is to grab a different language aka "the > right tool for the job" if I want to build things differently, that's why > we have so many programming languages and not just a few :) > > I'd put resources into optimising the VM and php engine to handle the > exceptions better and if there are improvements to be had there - do thos= e > maybe? (I suspect JIT is also going to influence this a lot going forward= ). > > Sincerely, > Arv=C4=ABds Godjuks > When what you have is a situation where a function or block of code goes "I know something fixable went wrong, but only the block above me in the execution stack knows what to do about it", Exceptions are extremely overkill. But they are the only "sane" option in PHP in a lot of situations= . PHP simply doesn't have a language level structure to handle this VERY COMMON situation. The fact that people have standardized on Exceptions for this is not a point in favor of Exceptions. It is a sign of how much extra performance and semantic correctness we COULD provide to the language by improving this area of error handling. I don't know if the OP of this email thread was referring to this situation. It was honestly very difficult for me to follow what they were even asking for given the language barrier. But I am 1000% behind the problem space that Larry is describing. Exceptions are not a solution to that problem, they are duct tape. Jordan --0000000000006ee8aa0610bbc752--