Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128343 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 lists.php.net (Postfix) with ESMTPS id F18CE1A00BC for ; Thu, 31 Jul 2025 13:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753968630; bh=JRSTD/nZAUDk2OtvpHLWr/L0LpE4tFAQ0fX1FVcvNds=; h=From:Subject:Date:References:To:In-Reply-To:From; b=lJgRIQy5Q2uLZI+1GAP6kZcRAX6i64Jt0muemifhdAg8DcPD39eTWMgmZf5GejIkq rvS2gTITDwfYYYu5pIMKNZKNtD2nHDBQH8bX50X7pB0DqS1mAwXnDNj5grMGOJOWz/ FWjBEVyJa19bbgZctOxMeJ0xRQn+WOX45M0YsBA7B0NGD5VJWyyTyMOIzsw73/Vcda /sgZ9nOSqFYSKus32Re3t3HE4BF+Jr1urJ4V/BgTL09wBFHYoHEzY2FSBA5R5mCCap D0U6NFmVZosrncM5MxdkOwHpbG1XcxIgib+ok4UtR8B4atHzJv0shwAA+CQDv2Xk0C beOVNVYXrKoKw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 506C3180059 for ; Thu, 31 Jul 2025 13:30:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail.gna.ch (darkcity.gna.ch [84.234.28.114]) (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 ; Thu, 31 Jul 2025 13:30:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.gna.ch (Postfix) with ESMTP id 31FB32381826 for ; Thu, 31 Jul 2025 15:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1753968729; bh=JRSTD/nZAUDk2OtvpHLWr/L0LpE4tFAQ0fX1FVcvNds=; h=From:Subject:Date:References:To:In-Reply-To; b=EOwz+RvXdQiCh9VGEdRUFLEshvQmfW6i06Iz6Eqy3yZJKDd4wW8Es7HxUTNzFAgKA PKIjXCNmrIwwrNelmj6TrpaNUawEAp0QRbrsGyds3DDlbT4tuCEOsrhLb9x0LYxdql mBnVQ5okIwxs0kSdLTp4jIBZuN2IpPTYd2847+Gg= X-Virus-Scanned: amavisd-new at gna.ch Received: from mail.gna.ch ([127.0.0.1]) by localhost (mail.gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZlSDPo-fJHv7 for ; Thu, 31 Jul 2025 15:32:08 +0200 (CEST) Received: from smtpclient.apple (unknown [194.169.219.181]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.gna.ch (Postfix) with ESMTPSA id 7F3DB2381821 for ; Thu, 31 Jul 2025 15:32:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1753968728; bh=JRSTD/nZAUDk2OtvpHLWr/L0LpE4tFAQ0fX1FVcvNds=; h=From:Subject:Date:References:To:In-Reply-To; b=huZaeCYX86snYjLTkspJ3oylV1MKZvS+ydUADr5HUMHdjhvrGc7P+ZKhjv9nL0lGh 5gPhrAvu4o1CVpucp/UQawmbZCqrOBHJyqdJpQtsnhAmMBPimjx8E94WbEBOF/B5Rw uFdliwgQJTYecxv+1a0GhijoYTtQh8GN5b4CKtu0= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [PHP-DEV] [RFC] Optional Catch Block Body Date: Thu, 31 Jul 2025 15:32:08 +0200 References: To: internals@lists.php.net In-Reply-To: Message-ID: <5A451842-1B55-4ADC-A747-C897FB3CE323@cschneid.com> X-Mailer: Apple Mail (2.3826.700.81) From: cschneid@cschneid.com (Christian Schneider) Am 31.07.2025 um 09:10 schrieb Rob Landers : > I can see something like this being useful in niche applications. For = example, I have a proxy generation class that creates something like = this: >=20 > public function remoteCall() { > $this->operation =3D nameof($this->remoteCall(...)); > $this->arguments =3D func_get_args(); > throw new SpecialException(); > } >=20 > This SpecialException gets caught to let me know the application has = consumed the one-use proxy. Using it looks something like=20 >=20 > rpc(fn(RemoteObject $o) =3D> $o->remoteCall()); >=20 > which just provides type-safe rpc at the expense of some boilerplate. >=20 > I also use empty exceptions to "jump" the stack when my framework = knows there is nothing more to do until outside events happen. I think I = could probably use fibers to do the same, but if the user is using a = fiber library; there is no guarantee they'll play nice together. This is = true with exceptions as well, but the user has direct control over = exceptions (do not catch Throwable, for instance). I'm not 100% sure I understood your examples but this smells like you = are using exceptions for flow (or maybe state?) control which I'm not = sure I would encourage. Regards, - Chris