Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61495 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92414 invoked from network); 19 Jul 2012 15:56:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2012 15:56:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.27 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.27 out3-smtp.messagingengine.com Received: from [66.111.4.27] ([66.111.4.27:37234] helo=out3-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/91-18983-94E28005 for ; Thu, 19 Jul 2012 11:56:57 -0400 Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 1534C209E2 for ; Thu, 19 Jul 2012 11:56:54 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute2.internal (MEProxy); Thu, 19 Jul 2012 11:56:54 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=DGGokIU2zi70uDT/A6Sf+K /sWG8=; b=DVWcm8EfxYosdtR9COANVginGw4Jsr6Z1WLXsX0OIBLpVEzoP/O8/g dK3RRFouL8THCOzUPKPk3TlTMm1212gf4b564GGUXWqS8TVzo2GSrBbJOHdCnjdQ EZ0emdVQxsfzg7G36WpukVm+xB/CCdgGrn+f3+hfjwo1KYIjwsv/0= X-Sasl-enc: 1otpq+WdIjhVWkisNdZzivCfFzSCqmzelkLxg4W1pzTv 1342713413 Received: from Palantirs-MacBook-Pro.local (unknown [209.41.114.202]) by mail.messagingengine.com (Postfix) with ESMTPA id C72134837EF for ; Thu, 19 Jul 2012 11:56:53 -0400 (EDT) Message-ID: <50082E45.307@garfieldtech.com> Date: Thu, 19 Jul 2012 10:56:53 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: internals@lists.php.net References: <5007D707.2070100@hoa-project.net> <095CAA408DA94AFB9E75C12877A9043D@charliesomerville.com> <50082B38.1070603@garfieldtech.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Make try/catch brackets optinal From: larry@garfieldtech.com (Larry Garfield) There is no such thing as an optional closing tag or brace. There's only lazy and sloppy coders, and parsers that encourage them. --Larry Garfield On 7/19/12 10:52 AM, Andrew Faulds wrote: > 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 >> >> >