Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61498 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96823 invoked from network); 19 Jul 2012 16:07:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2012 16:07:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajfweb@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajfweb@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: ajfweb@googlemail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:33395] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/92-18983-7C038005 for ; Thu, 19 Jul 2012 12:07:35 -0400 Received: by mail-wg0-f54.google.com with SMTP id 1so2060673wgx.11 for ; Thu, 19 Jul 2012 09:07:35 -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=LiZrKPYsBwY8SFkeP3FDJHRh8qSAloglzOJNS1vFjtA=; b=flP+cC96cQO/cVsYUlt8Q1g6GiXXYSAfEwUbCmejnQyLNWiLMXnnw7T6dF2I4nxFKX p9CGoaM2Bl1erdhWMC5k+barRd6Eal6/YHcQ5DiYBVlDiXitI8tkLsW9T8ZfbivbUzvu W9XCu/1RABKNXoPs781fN6LPc/Ks4x0eOtDaXa49KjwnzrI278rERUMuVnaU3sqG2jyH Lce8yI9IaFbszT+/a8m07FS1wAZjyZpaFQdNyEpDDZH3C1R+io45UBlCmfsWREq0Wlzw pW3RcbWlAfwuS1PsbOyy8WQ1+mFABt9MlqD0brB80hZkkzUng0UE+t+r1D7lXOa/L6ts xSJA== MIME-Version: 1.0 Received: by 10.180.100.37 with SMTP id ev5mr6131739wib.5.1342714054775; Thu, 19 Jul 2012 09:07:34 -0700 (PDT) Received: by 10.216.160.16 with HTTP; Thu, 19 Jul 2012 09:07:34 -0700 (PDT) Received: by 10.216.160.16 with HTTP; Thu, 19 Jul 2012 09:07:34 -0700 (PDT) In-Reply-To: <50082E45.307@garfieldtech.com> References: <5007D707.2070100@hoa-project.net> <095CAA408DA94AFB9E75C12877A9043D@charliesomerville.com> <50082B38.1070603@garfieldtech.com> <50082E45.307@garfieldtech.com> Date: Thu, 19 Jul 2012 17:07:34 +0100 Message-ID: To: Larry Garfield Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d041826d64514b704c530face Subject: Re: [PHP-DEV] Make try/catch brackets optinal From: ajfweb@googlemail.com (Andrew Faulds) --f46d041826d64514b704c530face Content-Type: text/plain; charset=UTF-8 HTML5 allow omitting head, body, html (they had no fundamental differences in parsing IRL), and also quotes and some end tags. Makes for much, much nicer HTML, e.g.: hello

hi

  • item 1
  • item 2
...that's off-topic though. I don't think we should have more tolerance of omitted braces in PHP. If you desparately want them, write CoffeeScript except for PHP (RasmusScript?) On Jul 19, 2012 4:57 PM, "Larry Garfield" wrote: > 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 >>> >>> >>> >> > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --f46d041826d64514b704c530face--