Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127198 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 958811A00BC for ; Sun, 27 Apr 2025 14:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745763435; bh=/GZoNHXZrjPu+eQiEz0Tk/PQ50hOHHwJeCGEz8uNzsM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UaN6E8UW7XwyLnmsDFxFGIWrdhCwxH/3F87UwEWvKJqLvD4qVy0tpLB4WWL4qW6GH le2xWnAfiuWxyTxMm7x+tluEPqkcaE+bL9LWqKtfLjaiTcDoAkmAR77OJOaMPa75hw DYS2jvjnlR+OhVm8m2FeddteFOqGgzKDj4GnGXzNbObBom+LHoETZtprw4Hq46l3ao QcMIxKDuwrylJVC0+EJT20aTbg95ztd87iyoyVBVzoYrMEZe30ovwUZwL0i9W/qqZk nln3v9+M7fU20ilAUZ5Jt4TJSUJzjgBCGeBim6rLqAjNlTGyG/6IALV4SywU+lTjnb C8RjLE0u3uEbg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E3B75180034 for ; Sun, 27 Apr 2025 14:17:14 +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_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 ; Sun, 27 Apr 2025 14:17:14 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-309d2e8c20cso4769149a91.0 for ; Sun, 27 Apr 2025 07:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745763571; x=1746368371; 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=jC21m6CCrtr4p5Xn+4aqa/3FRxAi4JWeJWdKGpnTecc=; b=FWxEABZoz8sTkqu5MoDeFzjxgKt7xyF2WgJ/Wh3/58yXmYXM8MSETAKKkKGlQVST2A Ovd+K/PtWVB+uaXRgs0MiT6APDitzz6buz1vsrFBlvth0kKHSDJEFAtFDzXa1DinUojX oplf1G1UrpE0kPMsFDXJVPK/D7d+ik4H0nOHeogqyqshWU0Of20FGk2yqN77LEShVXMo HRlUEYIVtnFnbvfLKKDOEeY0h7wU1yUHGA9qTg4f28fA8y8fAPdYUL2IVRLEZtej+/TZ SwYj6YqJFNt+gIWHC17GFhnYS2SCPw/QZwUJNymMVc0zg+gx7A8o/zj0k7BDrflPB56r 2FTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745763571; x=1746368371; 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=jC21m6CCrtr4p5Xn+4aqa/3FRxAi4JWeJWdKGpnTecc=; b=f9cHR+1ubFTA/A5nrCLn/c4w+y+tpphvTNdglgLNEHHroOv/9gbz3OsHcDzblZeCni s+ksyNZKLrzVyK9cM8NfaDjOQ6cC1180zTeGh2sMKe+QKTcBrTzMzmjOThpR2AF5d48T m+toWGAYToCkKQg4muGsvu2awPcaBepe49uclm9VqMnuLBLhQRH+sEjhhs5ZHUj8/AyL 0CizOo3GK354Cals5nGiQSpsIjumBaksFJaZCfG0pMGV1WoWU5LsfwmR/lnHpGDyKfTC /xy+Gp4rBcgMenqSOOg8HdzBSsVEpibG+I10xVqQwA9VIv4jkRB4XZ475yzhkIsYAEcm kR/Q== X-Gm-Message-State: AOJu0Yzp3xGPxYYP8jLDR0v4s5wH+gKG24JgyRrAV6WMMGjLob2Plpnk Fzc7tgbIR8AnjtJfg3JHIYyf2IKkxa79VGhm1BVZWQdT6JFofdeW64mQqH1B5WIyv9eFFElAvxQ rtDBcSOnVsGp3/R/2gbKzFJ/TzTCrzdhWLVU= X-Gm-Gg: ASbGnctXSYj4iGWP9S1l/2ipxugJ+iK+u4kPI6XGd/AKxuIS87DtFPY3QeAW52AWcD7 eXScTCF1eHD2/SmE51fovipsv/cJWoZLoFfsw08Ye1Kzh5HsUGe9y65Ti5Gp2yjClbxjC4kS/dV qiFx5AzEijGCvCwo5meVDhJqkCOFfZRByp0g== X-Google-Smtp-Source: AGHT+IFwab8l3mE8K71r+DEKKtxEgvxLaZOMCPP7FDElyxzHY5hyxatqzQQkyinLbGnMZ1q19p12RgOzntgtX7/4U8Y= X-Received: by 2002:a17:90b:4e90:b0:309:e351:2e3d with SMTP id 98e67ed59e1d1-309f7ddfe75mr16204644a91.12.1745763571043; Sun, 27 Apr 2025 07:19:31 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> <7bc87f46-7d5a-4848-b505-a77499281f45@gmail.com> In-Reply-To: <7bc87f46-7d5a-4848-b505-a77499281f45@gmail.com> Date: Sun, 27 Apr 2025 16:19:19 +0200 X-Gm-Features: ATxdqUHJI6lH7Yb3-bMDD4SvUGZPEHZ8-JNbzTtLPwHFaZGf0luzkWjcNUi2X8Q Message-ID: Subject: Re: [PHP-DEV] Concept: Lightweight error channels To: Niels Dossche Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000838f4f0633c341f6" From: ocramius@gmail.com (Marco Pivetta) --000000000000838f4f0633c341f6 Content-Type: text/plain; charset="UTF-8" On Sun, 27 Apr 2025 at 14:24, Niels Dossche wrote: > On 26/04/2025 09:17, Larry Garfield wrote: > > > * Exceptions are very expensive, the hierarchy is confusing, and > handling them properly is a major pain. Failing to handle them properly is > very easy since you have no way of knowing what exceptions the code you're > calling might throw, or its nested calls, etc. That makes them poorly > suited for mundane, predictable error conditions. > I get the point of having checked exceptions, and I suppose it would be > nice. > Hierarchy: I don't think the hierarchy is that confusing, can you > elaborate? > Regarding performance however, rather than introducing yet another > completely new concept to do almost the same thing, why not try to improve > exception performance instead? > Came here to say the same. Also: `Either`/`Option`/`Maybe` types, with some basic generics, even if only at documentation + PHPStan/Psalm level? I'm coming from months of Go development, and I really just want my exceptions (with traces by default) back, tbh, even if it means performance suffers. I just opened a PR that makes instantiating exceptions much much faster, > and this is only after like 15 mins of work. I'm sure there's even more to > gain. Nice! Marco Pivetta https://mastodon.social/@ocramius https://ocramius.github.io/ --000000000000838f4f0633c341f6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Sun, 27 Apr 2025= at 14:24, Niels Dossche <dos= sche.niels@gmail.com> wrote:
On 26/04/2025 09:17, Larry Garfield wrote:

> * Exceptions are very expensive, the hierarchy is confusing, and handl= ing them properly is a major pain.=C2=A0 Failing to handle them properly is= very easy since you have no way of knowing what exceptions the code you= 9;re calling might throw, or its nested calls, etc.=C2=A0 That makes them p= oorly suited for mundane, predictable error conditions.
I get the point of having checked exceptions, and I suppose it would be nic= e.
Hierarchy: I don't think the hierarchy is that confusing, can you elabo= rate?
Regarding performance however, rather than introducing yet another complete= ly new concept to do almost the same thing, why not try to improve exceptio= n performance instead?

Came here to say= the same.

Also: `Either`/`Option`/`Maybe` types, = with some basic generics, even if only at documentation + PHPStan/Psalm lev= el?
I'm coming from months of Go development, and I really ju= st want my exceptions (with traces by default) back, tbh, even if it means = performance suffers.

I just opened a PR that makes instantiating exceptions much much faster, an= d this is only after like 15 mins of work. I'm sure there's even mo= re to gain.

Nice!
--000000000000838f4f0633c341f6--