Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127224 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 567B01A00BC for ; Mon, 28 Apr 2025 14:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745849801; bh=8qS2nGNXGC48LfzDBqcuWXZyLQ8NbV4IQP9WQY3yhI4=; h=Date:From:To:In-Reply-To:References:Subject:From; b=VlOpoY3Ij4Gbb1c0mQHFZM+WrcXD/+2h4a3jmRV+GnGSFSK8NnI2KLFMuSwUIzItS roI3XdZ1Atj9jJ+T1d0GIbiUz4j65M3gaaOxDb/OXwppmnyQVxvXIvJgKwNWERjO+N 2uDNo8ZlsQb1pYu8UYAcpIwkab/uzWpdmhI5uQHQU1YFNEw1ZsBai/u4vDa/RLljio ypJSdIVtVZRw2u4XrsrUJJf8KysxayskVZvlK4XbBYW2IWDGkbcKwW0aZuZgB3Zh/Y elslISaFcWwNMht7ymPnw7jQTBuNP1p/xj5+Pxc2uGRQkwYDdOXG9kNot49117mcqu 2LFoqbU5L/ubg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 30F43180068 for ; Mon, 28 Apr 2025 14:16:40 +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.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE 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 fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) (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 ; Mon, 28 Apr 2025 14:16:39 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9CED1114024E for ; Mon, 28 Apr 2025 10:18:56 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-10.internal (MEProxy); Mon, 28 Apr 2025 10:18:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding: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=fm3; t=1745849936; x=1745936336; bh=qZzELJpS8bLUN7mcH2ctB JGae6ucjN7vnNUSHkLiC3c=; b=wEAnrVnxjANg7RIqBqj5mCgn+7uCFPXqHdr85 C5M//V0/sVFDxOBG4oP3WeMya5Ar0fmqfNzKiHH6/8SxoALF6U3D2cCIy1KeGTyk VuuvuamWjMcbMoDfeQ6KQ53qpHIrnhBKgQxV9NFWW4qwEjeH/XLV5F1jj04Z7uNd Y8VYy3QW4qBYkUbMhzMPmjbe5+SQ0u08V/RCpfPFQTsxlierT7JnFqDQAJvechfy RIJibDHI6Purv8WCzjCCmNX4Dvkgn4uITBDjNxLMRbzx65KPu//+tBUFNHM7lKYS 1ekxG74Jnq4qFEe4K4a/XalQa8quQKh1ZZ72bmZJ5rHMcH32Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=1745849936; x=1745936336; bh=q ZzELJpS8bLUN7mcH2ctBJGae6ucjN7vnNUSHkLiC3c=; b=N6DYFsbGRJYYto3qt Cybt9NCLVGdQ/NdPM005rltui4gi7UPhc7/dafxOxRwAwVxllQwMlR8tWVH8oihs QR9zAHKGecCwlUQptbl1P1UywZVLthX/jZVYt+OstUF+8/JjLsaQ82AEf3o/kE7V xeGBo6fUEAB8E/9fRmTYjPpjNP1qN7sjB6WrPJV16DnJsMFCLi6N7TxU3LZ6ahSS JpsY3IujSkSj7Ou2vrmC8L85agCXjHXKCNxXCaSBxzdRhSZNJuZgRrL5dgxuFfaT YK197uj18yfrlpAZb25n725OY7u3c3eOGSn2JoSd6wr9YEswKjRbELFDG9X10L3l iVIWw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieduudejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthejredtredt tdenucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrh hfihgvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpedugedvlefgueegheef jeetffduveeltefhfeegjeffffelgedttdevkeegkedugfenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 4ADCF29C0075; Mon, 28 Apr 2025 10:18:56 -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: T7e0f24752af1ea38 Date: Mon, 28 Apr 2025 09:18:35 -0500 To: "php internals" Message-ID: <150fb4df-47a4-4ab3-8edb-13e446b122cc@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: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Mon, Apr 28, 2025, at 6:46 AM, Edmond Dantes wrote: > Later in the letter you explain in more detail that this is *not a > special kind of exception*, nor a new execution flow, but rather a* > special type of result*. > > But if this is a special type of result, then it should follow *the > same rules as all PHP types*. In other words, this cannot be solved > without generics. I do not understand that statement in the slightest. I have already demonstrated how it can be solved without generics. Multiple response channels from a function already exist: Normal returns and exceptions. Exceptions as currently designed are just very poorly suited to the problem space I am describing. > However, the benefit of the new syntax, which could make the code > cleaner, does not depend on generics: > For example: > > ```php > $res = someFunction() catch ($err) {throw $err;} // Like Zig? > ``` A way to simplify try-catch syntax is certainly a possible side effect of this feature, though that is secondary to the point I am making. > However, it seems to me that we can achieve the same result using > `throw`, simply by adding new syntax and capabilities. Yes, there may > be some backward compatibility issues, but is it really something to be > afraid of? See other threads going on right now debating what BC breaks are acceptable and which are not. And let's not forget that every release there is an outcry of "OMG you broke my app!" for even the smallest deprecation of something widely acknowledged to be bad practice anyway. We should absolutely not be flippant about BC breaks in behavior. --Larry Garfield