Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128430 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 D037B1A00BC for ; Fri, 8 Aug 2025 06:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1754635743; bh=hr6ekEzdT7VNoz0ohaEvERaEolZpIn6NeVr5ArBK69g=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=kBx8P73QBfd2WBzzspjUQEFsFkKmI6d9/J/LQUHMww7mkVh1+npDuxe2aGASGIPq2 rLW/+GoONm7751Mbr8k2S8OfBmydnJ3dPqyxa3puU2n++rE/5M6J4gQtvz6g0AWYxN shvteE8HORogbbxYWwQj0FkXiL+BDeqGxLO7e6jB+oz2QXNBCda2KiJTCU3jrzU83+ ntjmUO1PHY5EK5MXmyokb8Ut0vD5LVK9P322I9IlWQX189A2KGuYzggwHyMKgH4MRt 3rcld8FArAqYLiwELlB9y9ip2G31JZqAYYzIgByAt0W7yIAX2VPCieqx6rdiZo9qov kI81GaASA8MLA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 60DC9180054 for ; Fri, 8 Aug 2025 06:49:02 +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,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (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 ; Fri, 8 Aug 2025 06:49:02 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 587D81D00184; Fri, 8 Aug 2025 02:50:40 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-05.internal (MEProxy); Fri, 08 Aug 2025 02:50:40 -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=1754635840; x= 1754722240; bh=u/s9NittUBVN31F0S/q3/c2xGRD/vYw1j5Ni/VKlV+I=; b=i lMGvERvtO/sH2TDOGPROD1v5OLFAZLNyF8rhV8+lI578gXR5i9wrTgcXQc5itfZN IsZJTLLv96/SkskOpp6/d7O06LnmAAA8O3GYi54MRNAvPjQ9pWYry/P9f7XgRq0j HLcqIWcWTOq3uwoEZUg2eJCzoEoVZvvoEK/Q5a8gofBe6oTXk/gRbcRP6NyAOJr4 uBCxS2tUbjYd/0YKn4KzUf6CwzVdFD+8SwTU5mFime8rd8cNVvL7Y0NS94ImhgBG 0cBLCl8+J3j5gg1B2VY8U8Nnhdi+a71mGE/DVhwfxLnYNH6zwm71Uu6ZLiCEuYa5 0YiQi4HSPOOIdtjKC8h4Q== 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= 1754635840; x=1754722240; bh=u/s9NittUBVN31F0S/q3/c2xGRD/vYw1j5N i/VKlV+I=; b=ZHl0Z0hgUwUZssSQsQzKb1w3VLfPyulubE6jjWi1VHntJwqsw3a AE85JTC/SdZd2rnTeHU87X5T5INvUhuC/6Kh6wpeRYorpYGlh5OR74kFVGb5hLuO lhd+jTWGp5l2enIFLNo25qNDSUql2kLFizv18CQCeQHT65Ja3zmsWKqCpnYG2pgE /kE7tLx7AIL9QVigrw/6jClJ++3k3VO7dYjbfasff3pEtyHj56XYmpweur0VY92e sJcV5NH8ob6xijtL7TDCeTqpQQxipq+ssxTKlJEupqaCUtmfSxt6CqSDfLtLZdoa szUumLQGXVq2KVA+6LjQKNdZMqxeG3jOQxg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduvdefudegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfn rghnuggvrhhsfdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtth gvrhhnpeegvdejudekgeethefggfeltdeiuedtkeektddujeekhfegkedvffffteegheev geenucffohhmrghinhephhgvihhglhdrohhrghdphhgvihdrghhlnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlhgvugdr tghouggvshdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepledulhhirghhihhmsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghnughrvggr sheshhgvihhglhdrohhrghdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrd hphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 899621820074; Fri, 8 Aug 2025 02:50:39 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AzoCpASj9aCJ Date: Fri, 08 Aug 2025 08:50:19 +0200 To: "Mihail Liahimov" <91liahim@gmail.com>, "Andreas Heigl" Cc: internals@lists.php.net Message-ID: In-Reply-To: References: <94a57a5c-41bc-442d-a5e3-13eaea29053b@app.fastmail.com> <7acfc0ad-74a1-47c3-92cc-2f6c330bdb04@heigl.org> Subject: Re: [PHP-DEV] [RFC] Optional Catch Block Body Content-Type: multipart/alternative; boundary=c2cef1a02c15495f92b30117ce3072fe From: rob@bottled.codes ("Rob Landers") --c2cef1a02c15495f92b30117ce3072fe Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Aug 8, 2025, at 07:57, Mihail Liahimov wrote: > Yeah, it seems to be problematic to use this syntax with finally block= s. Perhaps the optional catch block should be allowed only at the very e= nd, but it sounds somehow doubtful. >=20 > =D1=81=D1=80, 6 =D0=B0=D0=B2=D0=B3. 2025=E2=80=AF=D0=B3. =D0=B2 16:52,= Andreas Heigl : >> Hey Mihail >>=20 >> Am 06.08.25 um 13:34 schrieb Mihail Liahimov: >> > Hi! >> >=20 >> > At the moment, I can suggest this syntax: >> >=20 >> > try { >> > // do something >> > } catch (SomeIgnorableException) finally { >> > // do something >> > } >> >=20 >> I find that ... challenging >>=20 >> When reading the code I now have to go to the end of the line to=20 >> understand that the second >>=20 >> // do something >>=20 >> does not belong to the `try` but to the `finally`... >>=20 >>=20 >> And >>=20 >> try { >> // break stuff >> } catch (SomeIgnorableException) >> finally { >> // do something regardless >> } >>=20 >> seems boken due to the missing } >>=20 >> But well.... >>=20 >> We just have to adapt to something like this: >>=20 >> try { >> // break stuff >> } >> catch (SomeIgnorableException) >> catch (Some OtherIgnorableException) >> finally { >> // do something regardless >> } >>=20 >> --=20 >> ,,, >> (o o) >> +---------------------------------------------------------ooO-(_)-Ooo= -+ >> | Andreas Heigl = | >> | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2= =B023'58" | >> | https://andreas.heigl.org = | >> +--------------------------------------------------------------------= -+ >> | https://hei.gl/appointmentwithandreas = | >> +--------------------------------------------------------------------= -+ >> | GPG-Key: https://hei.gl/keyandreasheiglorg = | >> +--------------------------------------------------------------------= -+ What about instead of at the end, we do it at the beginning? try ignore (SomeIgnorableException, OtherException) { // break stuff } catch(UnexpectedException) { // fix stuff } finally { // do this anyway } Since ignore only can follow a try and any symbol other than a "{" is cu= rrently an error, I don't think we don't need to reserve "ignore" as a k= eyword. It appears to be relatively easy to scan/read as well. =E2=80=94 Rob --c2cef1a02c15495f92b30117ce3072fe Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Fri, Aug = 8, 2025, at 07:57, Mihail Liahimov wrote:
Yeah, it seems t= o be problematic to use this syntax with finally blocks. Perhaps the opt= ional catch block should be allowed only at the very end, but it sounds = somehow doubtful.

=D1=81=D1=80= , 6 =D0=B0=D0=B2=D0=B3. 2025=E2=80=AF=D0=B3. =D0=B2 16:52, Andreas Heigl= <andreas@heigl.org>:
andreas@heigl.org            =       N 50=C2=B022'59.5" E 08=C2=B023'58" |
| = https://andreas.heigl.org           = ;                     =            |
+-----------------= ----------------------------------------------------+
| https://hei.gl/appointmentwithandreas      &= nbsp;                   &nb= sp;    |
+-----------------------------------------= ----------------------------+
| GPG-Key: https://h= ei.gl/keyandreasheiglorg            &n= bsp;             |
+-----------= ----------------------------------------------------------+

What about instead of= at the end, we do it at the beginning?

try ign= ore (SomeIgnorableException, OtherException) {
  // break= stuff
} catch(UnexpectedException) {
  // fix = stuff
} finally {
  // do this anyway
}

Since ignore only can follow a try and any s= ymbol other than a "{" is currently an error, I don't think we don't nee= d to reserve "ignore" as a keyword.

It appears = to be relatively easy to scan/read as well.

=E2=80=94 Rob
--c2cef1a02c15495f92b30117ce3072fe--