Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128341 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 2DD841A00C1 for ; Thu, 31 Jul 2025 11:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753960474; bh=QWvYC8vp/tG1mrlWLkZui1rOU/Snez88Acgpa3rtwjI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=cTw8e5RUAoudAA0/5qXe84oAU2uBbmEjbU1a4HDecwIRp/AouqRs/z4bTNGyAmvAF GEUaaiHxqxSDdsHD9mznZIpXQ85KCTm3eUmMJ4MuiLASBzU9uAlM8Ooei1mUBdxhbO tyWXfFyA7bPtzTZ3VSK0h+l2gqnU8mNZ36o6Hurg320SkA+I+7wf2iunN/qfiNQNVo yveaydp/t8ug2BjKcJnag5gU+K3qTAWYdnCoKGtsz88XiG3lAt1XlZQt7emMhz9oUb s3CXDDsm0xfjQ/33btm4D31ziON55PoEz19HS+vKNuHHEuYvDzPGNpz9AFEvN8MGu0 Xp7sUCUyRxgdg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B493818005D for ; Thu, 31 Jul 2025 11:14:32 +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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,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 fhigh-a7-smtp.messagingengine.com (fhigh-a7-smtp.messagingengine.com [103.168.172.158]) (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 11:14:30 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 161A914002DF for ; Thu, 31 Jul 2025 07:16:12 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 31 Jul 2025 07:16:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=1753960572; x=1754046972; bh=fbDPPcurhhwzXT0JMMYtdyVNEdWZSRyGq3SWsRMRr8E=; b= O5lm8Cg3pUCLfAUIDI9OXa73MOkMseNYxfusXSddn3QxOuznYR+PfzO1QeJn0QWX zecyGv1BCn9jEb9xhVKSxnZtZjxTyUJcWj9Zc0TC+Mnjt5qjHc2FEcA87JEzI1cu WVk0qFS8XU5Wc3F1cTRdPyurnDfIPi2+PgC4yr4zSdCyFfYLjZy6aE0o0H7h1q68 2fCU+pODkSDDWevURxcP7XSD5cDpRybbjJpZHcQwLdLKbSoe4QMYgs5+4iZzb8ab VaKcRQURawgMurYrExM5fES5se++xFBOagXRHaMqP/rK5Gtsf4jCX0W6nbpHaS8F 3I5e23ScQ1fH13K5RCgO1Q== 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=1753960572; x=1754046972; bh=f bDPPcurhhwzXT0JMMYtdyVNEdWZSRyGq3SWsRMRr8E=; b=NcduyLwypGOjSCgvc Zedn3KKhGqLW1EfL4a57Ik0Kx16060zkxTvThqXsMaFXP0SYB5cxKH/1/QWdFFhw 3yA54XlYd2FHJSJLalzM05HTyELFoZ6QufgNRjxvhC3LxG68m/1AJaRF6zW2r3hZ 3CkPAusggrbWTCXxdHsW7GKfywk6gyHwtUXJh0Fw+Y/EJp0hpIDuwG71ECVxfeIK GmeR9S9RPgTgD8Q+HgkF7STm6cHWCc6WHfq775bKa/S5ZVHTooDrYc8OW5NH0f4t zLNDJIPKilNPJor9ol6D9oCVdng7eZMfCcLsbWIvsgDBr6nOdueaH29nRL71twtA lJN5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddutddtieejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertd dtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdfuceo ihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpeegtd dviedvkeehheeludeuffekkeeutdeuudehleegieetfffhueeutdekvdeuveenucffohhm rghinhepvgigthgvrhhnrghlshdrihhonecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdruhhkpdhn sggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvg hrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 31 Jul 2025 07:16:11 -0400 (EDT) Message-ID: Date: Thu, 31 Jul 2025 12:16:09 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Optional Catch Block Body Content-Language: en-GB To: internals@lists.php.net References: <095f25f5-695b-46d4-9f31-5d7e7a04ce05@rwec.co.uk> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 31/07/2025 09:31, Lynn wrote: > When I read `catch (Foo);` I read the intention of it being on > purpose, whereas `catch (Foo) {}` I can easily interpret as "the > developer forgot to handle the error" or "I can't tell if this is a > bug or not". As I say, readability is always subjective, but I would just see ";" vs "{}" as a style choice, no obvious difference in intention. If anything, it would risk me misreading the code, because I'd be looking for the braces and not finding them. A similar argument was made for keeping "var" as an alias of "public", to indicate ... something; I argued against that reasoning at the time: https://externals.io/message/91618#91634 I don't think the language needs to allow multiple ways of writing everything, just so that projects can have subtle conventions of when to use which one. > Now the boilerplate has increased from {} vs ; to quite some extra, > just to ensure the intention. I don't know if omitting the body for > this is the solution, or if there's something else we can do like: > `ignore(Foo, Bar)`. When I read the code I want the intention to be > clear, and an empty body just makes me doubt whether or not it is > intended and/or correct. If the aim is to make the intention explicit, we need some syntax that makes the intention explicit, not just different punctuation we hope will become established as a convention. > $foo = try $this->doSomething() ignore (Foo, Bar); I think an inline syntax like this would be a powerful feature, and a potential replacement for the @ operator: $fh = null; $fh = try fopen($filePath, 'w') ignore (FileLockedException); One challenge would be optimising it so that the exception didn't build a full stack trace then immediately discard it - this was touched on in Larry's thread a while back https://externals.io/message/127188 -- Rowan Tommins [IMSoP]