Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61509 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44983 invoked from network); 19 Jul 2012 18:22:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2012 18:22:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:40476] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/1D-18983-65058005 for ; Thu, 19 Jul 2012 14:22:14 -0400 Received: by yhoo21 with SMTP id o21so3549483yho.29 for ; Thu, 19 Jul 2012 11:22:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=UpAUkIQ5k6VDAFTnT1vSysn0q3m4ESKU+j/xZEwkUMA=; b=Hzdjq/nMoHPCxL0Et9ynfdtEDXVVGg2KSNlNBWVEEUCbfDEnbFYp1XkWECU3yFqcGB brnF1PJ9tD9n9aywqg2z3u8HepC+7vc/5qd3b16fKFaGVflcTByHUa3QNxv3OVzgrZM2 SmPoKoFtSQyoe4Jbaj72B9ZrBwImSBhJqOmD8B34DdTYLOWakMoDsVNftvYQqVJtTSXK SZG34vC/B5epAW69T4dKvuJLQbwibZtaFskO0xGyBgNO86bBjPdKE8N6eBRx0WRCH4eF hcEPotncaKR1anaRpzOnpsJTfFr7NLyFDcizjzkGl2/cG2MKp7e3NN2yO4zx5x6UP4kJ 4/xg== MIME-Version: 1.0 Received: by 10.50.41.195 with SMTP id h3mr2412188igl.34.1342722131562; Thu, 19 Jul 2012 11:22:11 -0700 (PDT) Sender: php@golemon.com Received: by 10.64.24.242 with HTTP; Thu, 19 Jul 2012 11:22:11 -0700 (PDT) X-Originating-IP: [2620:0:1cfe:28:8cb3:438e:1db2:b161] In-Reply-To: <5007D707.2070100@hoa-project.net> References: <5007D707.2070100@hoa-project.net> Date: Thu, 19 Jul 2012 11:22:11 -0700 X-Google-Sender-Auth: JOEHvKQeOPnxJywdLdXxORE0Rig Message-ID: To: ivan.enderlin@hoa-project.net Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=14dae934051daf117c04c532db71 X-Gm-Message-State: ALoCoQnZ49cNIMa1xVbuXnc2hKpIMwrIiOD4HFSughhuYp2OcTq24IXSGFvU9nlQpAg2996fGUc1 Subject: Re: [PHP-DEV] Make try/catch brackets optinal From: pollita@php.net (Sara Golemon) --14dae934051daf117c04c532db71 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable For all the reasons already stated, most explicitly because it make the code ugly as sin, my vote is somewhere between "No", and "Hell No." -1 on bracketless try/catch On Thu, Jul 19, 2012 at 2:44 AM, Ivan Enderlin @ Hoa < ivan.enderlin@hoa-project.net> wrote: > Hi internals, > > As you certainly know, brackets defining blocks in PHP are optional if > 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 > 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 > (uniformity actually) in PHP6 (or maybe before)? > > Best regards. > > -- > 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/ > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --14dae934051daf117c04c532db71--