Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127195 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 6654B1A00BC for ; Sun, 27 Apr 2025 08:26:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745742237; bh=pkvk0Jz/o2h5XngY+obLJYkMgzFCgumR+SqNGMYsrx8=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=LtBuU4soGMdfP1wxqMngafd+Ims//TgRAZmAZZ/Zy3gDhgxCCUxR7gGO7tH9GxV/L NUcT+wuLvp8y+ZxSXF3dtkEblxswhFRqRDFzme8OC35lQRpV9R+SQ4yAdmGDLCNIAN 4o4dyD4C6YVEqvCfGi+fvLISFDbn7GNkhkqmvbuHqyIJOkj+92z8bCIDXeVV/2aMn0 7Xw5qI8v2oP04MN9PReLRQQezUCmMrvbYr/SHEDVgSjdqRuRE8tIB1W13ao4dtsCWr RvOIi2wxL2WZGLfugkOsQWzAk9x1QUJVB7bFxYhlUDKK9C2lEFDKSeSsq6qNTxbPz6 d2GzwfopvZw0g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8DF98180055 for ; Sun, 27 Apr 2025 08:23:54 +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_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,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 fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (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 08:23:54 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 5ED4813801E1; Sun, 27 Apr 2025 04:26:11 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-05.internal (MEProxy); Sun, 27 Apr 2025 04:26:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1745742371; x= 1745828771; bh=dv0Wz6D6ix/DE8rmDWeIGLN5FY9RpmzMBpBN0dQAM+g=; b=x zPPAmsfQLyEwUUsxFvUqcEFGwsH0Qb+2uyHHtytDirDW7k5YB5JCELGFHM7VppX6 pKqWZmo+whY+6TfRMADUiBtKjzCgAq1rEnODBr8Zcr+x+9AiJ0JnEaVQeSnFoiRw vhLKZKDd9OcZKw81vaOReXBwVuQ5reNP+Haajs+UXHRLvN/4mjXBwoLB210ERKQe 8YQuVraCpslWNXIddUuT3yEEwXr32hVK3qQYV8e8PMMtlH0BDs2u50LBT9X+Ugtd JqqkWs7zevTMCgX0JY1S7d+qTJ/QBVKDd+PJEx6CuuQG9NPVZN1grud5u2pI/ACS Bd6ZyKh4y6Wct32FC1N1A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1745742371; x=1745828771; bh=dv0Wz6D6ix/DE8rmDWeIGLN5FY9RpmzMBpB N0dQAM+g=; b=B4wBDhAI40K9hlVWI2o4BunTQOTe5XA8Q76esa2S5A4GnK/XJ4G lmjwkED6105zPhBk5eP3lJObNRJMu9TCXFBSHXEOMfiO9oVbdx0SNaTwWEyHrJM5 sOB+Nso5pOTRGpCHM14oEPPW5Rtru5bFTzIy2KWXgrs0dvbF8wLtUV0oxd/rpRbx jyNLQJ4jJywj+a/O1/BJT6xNQ/AVS6c5zQH3iQGjjbx3rML9uuremfJxOODk1eQu 0uk35MO+hOeOlTt5hxbhn6JQwtaE7NOOZEI5JOcV7HAboEK1Yj1oXHPTwlkBrqqd brMx3G9Xo0XQ6OupaSIDHcwpVhtZZQ9sNnw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvheejheekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgesrgdtreerredt jeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurd gtohguvghsqeenucggtffrrghtthgvrhhnpeeiueethedvvdefjefhgfeiheelheehtdfh feekjefflefgvedvkeduteejjedttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghspdhnsggprhgt phhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehlrghrrhihsehgrg hrfhhivghlughtvggthhdrtghomhdprhgtphhtthhopegvughmohhnugdrhhhtsehgmhgr ihhlrdgtohhmpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnh gvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id B3A8B780069; Sun, 27 Apr 2025 04:26:10 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Tf8e68f75eb20cb92 Date: Sun, 27 Apr 2025 10:25:50 +0200 To: "Edmond Dantes" , "Larry Garfield" Cc: "php internals" Message-ID: <64f44c6f-a1ef-4a26-9063-d4d90fdf678c@app.fastmail.com> In-Reply-To: References: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> Subject: Re: [PHP-DEV] Concept: Lightweight error channels Content-Type: multipart/alternative; boundary=d8594c3679414eb3ae3ee0d88eb98e19 From: rob@bottled.codes ("Rob Landers") --d8594c3679414eb3ae3ee0d88eb98e19 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, Apr 27, 2025, at 10:16, Edmond Dantes wrote: > Good afternoon, Larry. >=20 > Looking at the comparison table, it seems that the two most important = differences are: >=20 > 1. Backtrace consumes a lot of resources. >=20 > 2. There is an explicit contract for exceptions thrown by a function. >=20 > 3. I didn't fully understand the point about the exception hierarchy,= but it seems important too. >=20 > It seems to me that the Backtrace issue is a problem of a low level of= abstraction =E2=80=94 the implementation of exceptions. That's one prob= lem. The lack of an explicit contract is a problem on a completely diffe= rent level of abstraction. >=20 > The issue with the missing contract could have been solved even for ex= ceptions, without creating a new entity. >=20 > Regarding Backtrace, the following questions seem fair: >=20 > 1. What if I want to know where the situation occurred? Can I just ig= nore this information? >=20 > 2. If yes, why not create an option to disable backtrace generation f= or exceptions? >=20 > Regarding the Result/Error type. >=20 >=20 > I have experience using this approach in remote services, where except= ions seem inappropriate. > It=E2=80=99s probably possible to use it even now without generics, an= d without any special language features. >=20 > What if we focus on: >=20 > 1. Improving exception handling, making it as lightweight as in Pytho= n. >=20 > 2. Introducing explicit exception contracts. >=20 > Best Regards, Ed. I'm not going to lie, I spent nearly an hour last night attempting to cr= eate an exception without a stack trace. I was quite surprised at how *i= mpossible* it is. The engine really goes out of its way to ensure the tr= ace is set. A simple solution (for this problem) may be creating a new exception typ= e \LightException or something that would allow for never setting a stac= k trace. This is pretty heavily on the "pragmatic" side of the solution = space, but it is also relatively simple. =E2=80=94 Rob --d8594c3679414eb3ae3ee0d88eb98e19 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sun, Apr = 27, 2025, at 10:16, Edmond Dantes wrote:

Good aftern= oon, Larry.

Looking at the comparison table, i= t seems that the two most important differences are:

  1. Backtrace consumes a lot of resources= .

  2. There is an exp= licit contract for exceptions thrown by a function.

  3. I didn't fully understand the point a= bout the exception hierarchy, but it seems important too.

<= p class=3D"qt-gmail-">It seems to me that the Backtrace issue is a probl= em of a low level of abstraction =E2=80=94 the implementation of excepti= ons. That's one problem.=0AThe lack of an explicit contract is a problem= on a completely different level of abstraction.

The issue with the missing contract could have been solved even for e= xceptions, without creating a new entity.

Rega= rding Backtrace, the following questions seem fair:

  1. What if I want to know where the situa= tion occurred? Can I just ignore this information?

  2. If yes, why not create an option to di= sable backtrace generation for exceptions?

Regarding the Result/Error type.

<= /p>

I have experience using this approach in remote services, where = exceptions seem inappropriate.
It=E2=80=99s probably possible= to use it even now without generics, and without any special language f= eatures.

What if we focus on:

    =
  1. Improving exception handl= ing, making it as lightweight as in Python.

  2. Introducing explicit exception contracts.

    =
Best Regards, Ed.

=
I'm not going to lie, I spent nearly an hour last night attem= pting to create an exception without a stack trace. I was quite surprise= d at how impossible it is. The engine really goes out of its= way to ensure the trace is set.

A simple solut= ion (for this problem) may be creating a new exception type \LightExcept= ion or something that would allow for never setting a stack trace. This = is pretty heavily on the "pragmatic" side of the solution space, but it = is also relatively simple.

=E2=80=94 Rob
--d8594c3679414eb3ae3ee0d88eb98e19--