Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128429 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 50F221A00BC for ; Fri, 8 Aug 2025 05:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1754632542; bh=tgQ/vQpSlYspXdWjmzGlSFywTuijACKJJRuisCoyAS8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=j4obZA5gAVLYL+e4Mc71ZCVCpH37HPIvo6s2JqiLUYQnC4Zm826dPD/3+om2nNigH kNKTKSyjflVtdYdZ8gOD4MOUQpQO6lZVX6Cwq8LQrtsVxpIUMd/3nm+JIX8X1pPQyt Qdu38qYqMqYHKP+tQUuDg7AquoOLqVTxI2IiZsWVExU38TkYW4Fas0NUp7DUHIMGF9 D8fYHxr3WFK1LhUNDWwSRSA1PZA3BaPsHM9Uex9FoZGIjEUg0ZCKViFtGQxQeBw3wI pdog7+WpRZgAZaOx8ZaqteL53cXQkQ6bcstQD1AH8Mi5hW8Sgtenwx/DsnOs2nWLL7 pMxP4u85ZRVWQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 58715180054 for ; Fri, 8 Aug 2025 05:55:42 +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=-0.4 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.1 X-Spam-Virus: No X-Envelope-From: <91liahim@gmail.com> Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 05:55:42 +0000 (UTC) Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e902e1a2996so1472514276.3 for ; Thu, 07 Aug 2025 22:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754632640; x=1755237440; 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=A31/sOT5NS+kppS66aw3uR4THvy2kkqnJD3C6keP/bs=; b=TgODB6PzQBlb60f5KN3IznPgYjf71nuBCsHGJ/OBUkZyp/aSWV2WbjCko59gl9hHDR vG7hiAiDe3SEUjaq830b7PU3iO4nP4pKpLLfvWriamzpHR1VKmICO7xY6Vrlj7Jz4SGV hlZ3iggvOT1dpIJYsNUaGjgalmOb2zzoB1b8w8xucPMOrL5gDxOW8tt68YOeockkHjuR sDS2LkhTT5W1+hE2uz2l7+pfVrI4KVmInOt2HGUajezBIgZNicBIGECeoNR3Jpfx05Px FdwliLK/tPCjGCGlPy2AEadZ/iIUx4PgMzHyTXUgcKh6o/uFzNIB1Q7tjNjQAHJJkmJJ 1Qug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754632640; x=1755237440; 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=A31/sOT5NS+kppS66aw3uR4THvy2kkqnJD3C6keP/bs=; b=H4vEVlVK+fYTjGgmFhNeSW0daP9OR3dpdr7tLm9xZa1bsLi59WkKVkysEs6L4nvSzh 3sZUw1lU3Ceatdu7XdmOlgDmyvO75FRq2ispbxrkNwOm52lBPC/al+h74K8z8yEpRJv6 43L6opw3glvx/n5jh/z3JpffsSdAz+eLDDwJfKca52t6MGRP1Xo1No2WvnC6cHkJBbDp mqnMlPQWXFLXSVN+3wX4KrCXnPKdSotfIW01crjN4Rmv+HKaKljjOuEWdjSJW6qXyDqM WD5SvY8YBkNxdoKmxfHhmd2N7eIHS7xd3UK3gK8OCDBEeZuvHqVKcQqmw3LCORiZ/1zf rkPw== X-Gm-Message-State: AOJu0Yyj0AMEZJPL6RHPK0CV+Y03dV+INorjhbd3I1wzCBUL0VbQX4iz vfhF1YLgeChtnr2kyyHlnjHsTsteCVagacvqIs36dVIQswwiF9jZC1OdrNyrJf9pMQi4fo9rmTL /lSasDFXMtgmvP484sVmG2EOgyte0lM5/J9PM X-Gm-Gg: ASbGncs8fQ3dfM/p53sR6h4W7ixovoZ1Qax4URJTMUu91wm8SSX2KKRRZYqX8PymmwE wZZWdVL77bZeM5WXM83rhmrt5tiTb3hZJALLQJ+GkBDUpTe/xLud70HjNKgSz6y7DRnsRhON/UX XwY/onRE7MvUDlU36t5G0emYu0jCG/FBDCUhVa72muzttR4S6kpss2cRElzuQpgi3QipLg1XOOr DCPHjs= X-Google-Smtp-Source: AGHT+IHbTeqa5i+4b5nOOZJS0caGihMCsK5Z/wNYNYb3fK+1suaSslSX+MrwPSk8su6VLBkiALgbO+QbG6trKZf64iQ= X-Received: by 2002:a05:6902:154d:b0:e8f:ec13:20fb with SMTP id 3f1490d57ef6-e904b5f7769mr1665743276.48.1754632640039; Thu, 07 Aug 2025 22:57:20 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <94a57a5c-41bc-442d-a5e3-13eaea29053b@app.fastmail.com> <7acfc0ad-74a1-47c3-92cc-2f6c330bdb04@heigl.org> In-Reply-To: <7acfc0ad-74a1-47c3-92cc-2f6c330bdb04@heigl.org> Date: Fri, 8 Aug 2025 10:57:09 +0500 X-Gm-Features: Ac12FXyFdL3ptXBk3ucg3-gwncStIhUI89NoSIWHYV9W3QiX-VisEMrIQ-8y0M8 Message-ID: Subject: Re: [PHP-DEV] [RFC] Optional Catch Block Body To: Andreas Heigl Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000388d6a063bd43f40" From: 91liahim@gmail.com (Mihail Liahimov) --000000000000388d6a063bd43f40 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yeah, it seems to be problematic to use this syntax with finally blocks. Perhaps the optional 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, Andr= eas Heigl : > Hey Mihail > > Am 06.08.25 um 13:34 schrieb Mihail Liahimov: > > Hi! > > > > At the moment, I can suggest this syntax: > > > > try { > > // do something > > } catch (SomeIgnorableException) finally { > > // do something > > } > > > I find that ... challenging > > When reading the code I now have to go to the end of the line to > understand that the second > > // do something > > does not belong to the `try` but to the `finally`... > > > And > > try { > // break stuff > } catch (SomeIgnorableException) > finally { > // do something regardless > } > > seems boken due to the missing } > > But well.... > > We just have to adapt to something like this: > > try { > // break stuff > } > catch (SomeIgnorableException) > catch (Some OtherIgnorableException) > finally { > // do something regardless > } > > -- > ,,, > (o o) > +---------------------------------------------------------ooO-(_)-Ooo-+ > | Andreas Heigl | > | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2=B0= 23'58" | > | https://andreas.heigl.org | > +---------------------------------------------------------------------+ > | https://hei.gl/appointmentwithandreas | > +---------------------------------------------------------------------+ > | GPG-Key: https://hei.gl/keyandreasheiglorg | > +---------------------------------------------------------------------+ > > --000000000000388d6a063bd43f40 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Yeah, it seems to be problematic to use t= his syntax with finally blocks. Perhaps the optional 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@heig= l.org>:
H= ey Mihail

Am 06.08.25 um 13:34 schrieb Mihail Liahimov:
> Hi!
>
> At the moment, I can suggest this syntax:
>
> try {
> // do something
> } catch (SomeIgnorableException) finally {
> // do something
> }
>
I find that ... challenging

When reading the code I now have to go to the end of the line to
understand that the second

// do something

does not belong to the `try` but to the `finally`...


And

try {
=C2=A0 =C2=A0// break stuff
} catch (SomeIgnorableException)
finally {
=C2=A0 =C2=A0// do something regardless
}

seems boken due to the missing }

But well....

We just have to adapt to something like this:

try {
=C2=A0 =C2=A0// break stuff
}
catch (SomeIgnorableException)
catch (Some OtherIgnorableException)
finally {
=C2=A0 =C2=A0// do something regardless
}

--
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0,,,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (o o)=
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
| mailto:andreas@hei= gl.org=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 N = 50=C2=B022'59.5" E 08=C2=B023'58" |
| https://andreas.heigl.org=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0|
+---------------------------------------------------------------------+
| GPG-Key: https://hei.gl/keyandreasheiglorg=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=
+---------------------------------------------------------------------+

--000000000000388d6a063bd43f40--