Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61494 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90831 invoked from network); 19 Jul 2012 15:52:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2012 15:52:22 -0000 Authentication-Results: pb1.pair.com header.from=ajfweb@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajfweb@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: ajfweb@googlemail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:40259] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/41-18983-63D28005 for ; Thu, 19 Jul 2012 11:52:22 -0400 Received: by weyr1 with SMTP id r1so2165278wey.29 for ; Thu, 19 Jul 2012 08:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=joGDNGf1Tq/+SMfENd7hlddpXvvxwg3Lr72GYWXNZec=; b=w4FbK6IoZRnyYI4EABdE7KdWx2LbhD3jNSV5xz9XbbjlQyVXP7Ot8U7VkIMQqx3rc6 atElto1Gn+GviHyXUpoFTzoWQuvPVBgku4tEKnu5u9hmbageEaE2WNC1HjFw5G5vcRvP ow88rkTN9470fCxjUkqBvpHElGN1tcC/e4AgnsxVz2Jg5/WmBa2liB61vKroM9pj/dWR x0JwNv50BNlTBMxdU43y4csWgm1PobtJkF4S/gn9IvQ+GK2R0TjCJbKS0fjEXR90AnSs 9+BvGI2/fQA3cbm5WnDReOwVXJdHoJK8m42PKgDT4stFjG+JyVudqHij09/e/Lg9a5am OnCw== MIME-Version: 1.0 Received: by 10.216.220.89 with SMTP id n67mr1691327wep.73.1342713139845; Thu, 19 Jul 2012 08:52:19 -0700 (PDT) Received: by 10.216.160.16 with HTTP; Thu, 19 Jul 2012 08:52:19 -0700 (PDT) Received: by 10.216.160.16 with HTTP; Thu, 19 Jul 2012 08:52:19 -0700 (PDT) In-Reply-To: <50082B38.1070603@garfieldtech.com> References: <5007D707.2070100@hoa-project.net> <095CAA408DA94AFB9E75C12877A9043D@charliesomerville.com> <50082B38.1070603@garfieldtech.com> Date: Thu, 19 Jul 2012 16:52:19 +0100 Message-ID: To: Larry Garfield Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016e6d77ce3bc5a1204c530c340 Subject: Re: [PHP-DEV] Make try/catch brackets optinal From: ajfweb@googlemail.com (Andrew Faulds) --0016e6d77ce3bc5a1204c530c340 Content-Type: text/plain; charset=UTF-8 Always close

, but never close

  • :) On Jul 19, 2012 4:44 PM, "Larry Garfield" wrote: > On 7/19/12 5:11 AM, Peter Beverloo wrote: > > I have seen this problem happen, people losing time trying to figure out >>> what is wrong only to find >>> its a missing bracket. >>> As Paul said, this is bug-prone. >>> >>> >> Other bracket-less blocks allow authors to shoot themselves in the foot >> equally so, yet PHP supports these as well. The actual problem here is an >> inconsistency in the parser, which I'd consider to be a bug. >> >> Peter >> > > > PHP doesn't support optional brackets on functions, either; please no one > suggest that. > > Yes, it's inconsistent that some structures allow short-circuited > brackets. The solution isn't to let all structures have the bug-attracting > syntax. If it wouldn't break a few zillion lines of existing code I'd say > we should resolve the inconsistency by making the braces required on > if/foreach/etc. PHP only has them optional due to a C/C++ legacy, which > may have made sense when the byte size of source code actually mattered for > storage efficiency. > > Yes, I have run into bugs that were caused by people forgetting braces. > Yes, I have introduced bugs without realizing it because someone left off > a brace and I didn't notice it. Yes, I now always add braces when looking > at someone's code; I can't even read it otherwise anymore. Any respectable > coding standard requires the otherwise-optional braces. > > And yes, I always close my

    tags as well, and so should you! :-) > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --0016e6d77ce3bc5a1204c530c340--