Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61552 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13881 invoked from network); 20 Jul 2012 09:49:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2012 09:49:30 -0000 Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:55400] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 32/CD-18983-9A929005 for ; Fri, 20 Jul 2012 05:49:29 -0400 Received: by lbgc1 with SMTP id c1so5433372lbg.29 for ; Fri, 20 Jul 2012 02:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer; bh=WrOTWfF+COwwbI5WnSt06G6Ilu0TkTj1x29O9LTx6k4=; b=0uujQ4iMV1GXh8zItauYZswxvaSOZfn6aj14Yt40nTERPLvjnuqgRZjwBKKJpR2BUO M5nehwOqX8cCeSSA6ebjyZ+bcqC7PexZNe7YjEuUtiFxR6jwugH0k/NJ2q7tq3B34OZv dczopq2jaTVnq6ED3QG4P4U2i9QUbcCqFeGjVKe+lP8fHUXaXA+OTXJuMKQ7BCDgpC2x WfJMmi1XlSDm/bLQwkWzRMjajALHF7yGDsYnJwbo7DUqWj8cJfF+NL/2ONQ8VigHwpgx sKJtWvmJmNfv8NznJKbeU0V7USDbOY5Ron9tAB6L8k+Lzb1WrAlwVR6xQTd5Wv55uVKK Tzgw== Received: by 10.152.106.233 with SMTP id gx9mr5498819lab.48.1342777765683; Fri, 20 Jul 2012 02:49:25 -0700 (PDT) Received: from [10.0.1.7] ([93.185.190.227]) by mx.google.com with ESMTPS id k4sm1024202lbb.12.2012.07.20.02.49.23 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 20 Jul 2012 02:49:24 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/signed; boundary="Apple-Mail=_34B59E1E-A7BA-4A73-A8E2-2DFF7F1CDBC8"; protocol="application/pgp-signature"; micalg=pgp-sha1 In-Reply-To: <500917C7.3050302@hoa-project.net> Date: Fri, 20 Jul 2012 13:49:24 +0400 Cc: internals@lists.php.net Message-ID: <3BF315E8-AF41-41F4-B1EA-16802BB07C50@gmail.com> References: <5007D707.2070100@hoa-project.net> <095CAA408DA94AFB9E75C12877A9043D@charliesomerville.com> <36467402DA0F4332A523162E3C278042@gmail.com> <500917C7.3050302@hoa-project.net> To: ivan.enderlin@hoa-project.net X-Mailer: Apple Mail (2.1278) Subject: Re: [PHP-DEV] Make try/catch brackets optinal From: indeyets@gmail.com (Alexey Zakhlestin) --Apple-Mail=_34B59E1E-A7BA-4A73-A8E2-2DFF7F1CDBC8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On 20.07.2012, at 12:33, Ivan Enderlin @ Hoa wrote: > Making braces optional for try/catch does: > + not break backward compatibility; > + add consistency in the PHP syntax; > =B1 offer a new way to write buggy programs but no more than with = other control structures (think about goto ;-)). >=20 > I see more + than - here. Am I wrong? You are not wrong. This is the inconsistency and it makes sense to fix = it. We are definitely not going to "unfix" it for if/else, so I "+1" your = proposal in advance > Moreover, in parallel, a new idea has been landing: introducing the = =93rescue=94 keyword as a shortcut/replacement of try/catch, such as: > $foo =3D callThatCouldThrow() rescue 'oof'; > Is it possible to chain it, such as: > $foo =3D callThatCouldThrow() rescue anotherCallThatCouldThrow() = rescue 'oof?'; >=20 > Maybe we should start another topic because it could be a nice idea. I don't see value in this. "finally" would be much more valuable. try { doSomething(); } catch (\Exception $e) { handleException(); } finally { genericCleanup() // called if everything is good, if everything is = bad or even if exception is rethrown }= --Apple-Mail=_34B59E1E-A7BA-4A73-A8E2-2DFF7F1CDBC8 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) iQEcBAEBAgAGBQJQCSmkAAoJEM8kLGy4PJ4JVRUIAM/WD94aWZGsHE5dEL+d9CU8 Ct6R1N2LtGdwzgvC0JV/072Am/y266Whzvl+CXHYeDw545b5oYpz5EqiVFrLTHHL jdGxiYIXV65OT0m3sPC1ZU+rV6PwGBDgY6nH5jH3yhGSzwMylsD1MrbiIlRjAzdR Pts05J1lBFggOtmcgYk0QwMab22S3y8Xwu7sDJyQT0WSij/lnXK1SVIAljDuD1Fp 4aTEvS58W/l16Le5fVovzp8wFECfPrSCj5pFNUcRprKf2nDp++zou7K5axNuFv/x l9nJdr/HaMY3nYJvW1tZ101Rs5EGqAuwmcHNW47nHUggK/dA7masi7nHYFVsxCs= =C2IC -----END PGP SIGNATURE----- --Apple-Mail=_34B59E1E-A7BA-4A73-A8E2-2DFF7F1CDBC8--