Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127194 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 F172E1A00BC for ; Sun, 27 Apr 2025 08:16:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745741651; bh=24eUz+7Fosre/ULGsFUrtata6TwOL4kmv720E2yaOds=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=bOjeWaUX2v9kN9VQI1xHUvR8HdBPJNd7ppgvQdy0zYzSlrEba9fZlPXcjG0mN7obg qBdU8uwB9+Bo6IPn9seve/ZdPhNsCJIS3XcvPL1gqAj7Fun4gJhK1vc6R9k21JJ4y5 mgrBzW6eRkFONML0iwWcHO31dfwHfJaWRM5nmdSY1khgjSx6Fd8hYk0qPZVB5wyQIC IwBi0+HFnpfmqFhnOR5XfziN2k5JmRUVqsRH8Wp7MiqvglMKZacdcWEXGTJQgxWV7N x+RTaxT8abnxqo/lIAcikpIzkHnNFx6+7juQ0sA1b44JYOLrkXSjDUKFJgEiKzQQ/x NBw1O2gOad3wQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3E44D180081 for ; Sun, 27 Apr 2025 08:14:10 +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_H2,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-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) (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:14:10 +0000 (UTC) Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-e573136107bso2985596276.3 for ; Sun, 27 Apr 2025 01:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745741787; x=1746346587; 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=+PupCF5tVfuQ/EoVmq8XAylmpbsl9+9MENIT3uV8Rjs=; b=TR4UhqNcQXeOUagA69plzwa9gbNFSrK8knkJyTU1xXthh1btLEpOetRe/MiO5f18xq XvQsRRTXtbQGDDM4unDy6VvkuVjwme7X/hJUKB3f6A5rOsumTSrkT1yvGbNoG/EPFrej SiYyFPYOnBSrN8JmDhrxaAW2i5HikouLurFYvuq/96pMJJ1QKT9oXKD4O42jkTbMhADi W9kS4rqcxPB/QgKIY61Hl12FF9L9mRK25J1C+YpsMBJJo9s/tTZRO8C4UNFC6NZZ9+fM SSrDXz4AZsNqO76YK/zecbEymL+YaxIQo7Wm7O4/vLRSj2RNdBA/o6VRh/QY0e0yCGZr 1Big== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745741787; x=1746346587; 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=+PupCF5tVfuQ/EoVmq8XAylmpbsl9+9MENIT3uV8Rjs=; b=G9AIxAnrmK0la1nSUWdVmOlRgnibdckHvcBioHHgvaMrn7MljpwsWR5HVFJxUPhWiF 1w3MZWmb9hL+f5f3W2looVXH8LbAnDlwPUnA9efUhKx+TCP2dhuV1xZOnwmuTR7mmyUW FXD/fiR21K56uo1zFQUihSmjMyKinvjd/7jfAzu2yYqU6IZyNh6VonK7lCeBXl1LwhU9 N7Grc9XkZMNahEtSfY3ko7XU71Rdm6OEg0ns2tsBEXA4fC2OQlGCEJWn89K+7hrbOhZj dD1R8HHt/un3py/u7K/Y1+DrPkLRgaUzjV/3N72a7soCwRBSzIBFRZdozkxAQtXvXtG9 ArKA== X-Gm-Message-State: AOJu0YxCzOirTBWfMB04glikVfYk8SlWOWK5ODGZx1/aGZA3BGEM0Kip +nZrf0r8ESqXq227jrik8iJITa2L7mwKpojk/jNncfuoH2HpzU9O0lCnQVpMNZ/pKa32SjHItqa bhEifJo16PLuzZ4RteoXzwy4uvntBwo/i X-Gm-Gg: ASbGncuTAxcn71WwJBIwDMGOIRvRYH1ajSg7HiH4FuKbwcUzIz2obS6QubPDfgiEQS9 /vJXmzhW2DLI6VqRk1zrvnbYeb4qwfz6EkDo/FZD0qK76RSNPkWGOvWZwTszf1IE8FXGR8ZVFYX 9+/Kh2f5QFQunkq2MlZUcvz0KDJadUR6/D X-Google-Smtp-Source: AGHT+IFWz+ucNxbeCoUJNFSOOf0Iv3ys12/X2tZZrUhRe4C9PbJXpFkQmmzLeqSHzVS6I5tpGOa0FB/doRJtqYLlWFI= X-Received: by 2002:a05:6902:1612:b0:e73:2aca:55a3 with SMTP id 3f1490d57ef6-e732aca5707mr4497118276.37.1745741786920; Sun, 27 Apr 2025 01:16:26 -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> In-Reply-To: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> Date: Sun, 27 Apr 2025 11:16:16 +0300 X-Gm-Features: ATxdqUHVqOA0aYR99XnZsfE24fcC5eaqecEXBh-ubrP8-aTAj0vobSpYhrpnbY8 Message-ID: Subject: Re: [PHP-DEV] Concept: Lightweight error channels To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000014412c0633be2f0d" From: edmond.ht@gmail.com (Edmond Dantes) --00000000000014412c0633be2f0d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Good afternoon, Larry. Looking at the comparison table, it seems that the two most important differences are: 1. Backtrace consumes a lot of resources. 2. There is an explicit contract for exceptions thrown by a function. 3. I didn't fully understand the point about the exception hierarchy, but it seems important too. 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 problem.= The 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 exceptions, without creating a new entity. Regarding Backtrace, the following questions seem fair: 1. What if I want to know where the situation occurred? Can I just ignore this information? 2. If yes, why not create an option to disable backtrace generation for exceptions? Regarding the Result/Error type. 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 wit= hout any special language features. What if we focus on: 1. Improving exception handling, making it as lightweight as in Python. 2. Introducing explicit exception contracts. Best Regards, Ed. --00000000000014412c0633be2f0d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Good afternoon, Larry.

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

  1. Backtrace consumes a lot of resources.

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

  3. I didn't fully understand the point about the excep= tion hierarchy, but it seems important too.

It seems to me that the Backtrace issue is a problem of= a low level of abstraction =E2=80=94 the implementation of exceptions. Tha= t's one problem. The lack of an explicit contract is a problem on a completely different lev= el of abstraction.

The issue with the missing contract could have been sol= ved even for exceptions, without creating a new entity.

Regarding Backtrace, the following questions seem fair:=

  1. What if I want to know where the situation occurred? Ca= n I just ignore this information?

  2. If yes, why not create an option to disable backtrace g= eneration for exceptions?

Regarding t= he Result/Error type.

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

What if we focus on:

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

  2. Introducing explicit exception contracts.

Best Regards, Ed.
--00000000000014412c0633be2f0d--