Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61463 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35067 invoked from network); 19 Jul 2012 09:44:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2012 09:44:47 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:46692] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/71-25752-B07D7005 for ; Thu, 19 Jul 2012 05:44:44 -0400 Received: from Hwhost2.local (36-128.77-83.cust.bluewin.ch [83.77.128.36]) by host1.trois-doubles.net (Postfix) with ESMTPA id EEED4207179 for ; Thu, 19 Jul 2012 11:44:39 +0200 (CEST) Message-ID: <5007D707.2070100@hoa-project.net> Date: Thu, 19 Jul 2012 11:44:39 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120715 Thunderbird/15.0a2 MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Make try/catch brackets optinal From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") Hi internals, As you certainly know, brackets defining blocks in PHP are optional if=20 blocks contain a single instruction. Thus: if($condition) { echo 'foobar'; } is strictly equivalent to: if($condition) echo 'foobar'; But this syntactic sugar is not applied uniformly to all PHP language=20 constructions. I have the try/catch couple in mind. First, I would like to know why it is not possible to write: try throw new Exception('foobar'); catch(Exception $e) var_dump($e->getMessage()); as a strict equivalence of: try { throw new Exception('foobar'); } catch(Exception $e) { var_dump($e->getMessage()); } Second, if it is possible, could we plan to have this =93feature=94=20 (uniformity actually) in PHP6 (or maybe before)? Best regards. --=20 Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/