Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61474 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52523 invoked from network); 19 Jul 2012 10:45:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2012 10:45:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=rumi.kg@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rumi.kg@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: rumi.kg@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:64991] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/15-25752-465E7005 for ; Thu, 19 Jul 2012 06:45:57 -0400 Received: by pbbrp12 with SMTP id rp12so4522760pbb.29 for ; Thu, 19 Jul 2012 03:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BC660ZEjDW0tjS2ekPGCj5EuIPfnQ8pr4M7qfOtXvwc=; b=E+f7aYrDTu2XEKaTqwmhS3oNhBYqw1ggJ0B26a8nHkue6yj9e60AaV7niQq+wCrwLR hfvj2p/kiB09fS/t0i7EwLq94EK8W3AFl90sB8mPSbzq1ju2yAQIF3NZS1Fj1penw+Ex nXqOqaCs3jRCnGXfljMGw5zgXkuW/sKhlA6xLvYqSEIE1KcHtkkxUgxfZwehbS+ZDMIe It+RjXyzRlZIHEsbY+bBwGV+Ai80K+KS5jnOO3EG6ThWPcA+SwnyRvzmfqqu8D0x/ZP5 P3cTlBQNbjPIHOIuNuwfUSvXzv15r7EzF9K5Ke2XvBsaOzt0zm2cesm6ajXPkXYpXhLi pFbw== MIME-Version: 1.0 Received: by 10.68.232.229 with SMTP id tr5mr4241724pbc.101.1342694753415; Thu, 19 Jul 2012 03:45:53 -0700 (PDT) Received: by 10.66.152.142 with HTTP; Thu, 19 Jul 2012 03:45:53 -0700 (PDT) In-Reply-To: References: <5007D707.2070100@hoa-project.net> <095CAA408DA94AFB9E75C12877A9043D@charliesomerville.com> Date: Thu, 19 Jul 2012 12:45:53 +0200 Message-ID: To: Peter Beverloo Cc: Rafael Dohms , Charlie Somerville , ivan.enderlin@hoa-project.net, internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Make try/catch brackets optinal From: rumi.kg@gmail.com (Rune Kaagaard) +1 for the consistency of it. It's surprising that: if ($foo) return $bar; else return 42; works and: try maybe_dangerous(); catch(Dynamite $e) handle_error(); does not. On Thu, Jul 19, 2012 at 12:11 PM, Peter Beverloo wrote: > On Thu, Jul 19, 2012 at 11:06 AM, Rafael Dohms wrote: > >> On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville < >> charlie@charliesomerville.com> wrote: >> >> > This has code readability problem written all over it. When maintaining >> it >> > also has problems, like with the bracket-less if's. >> > You would need to add brackets if you add an extra line here, as well as >> > you might get unexpected behaviour of you forget to >> > add brackets in that case. >> > >> > I've often heard people make this argument, but I've never found it to be >> > a real concern in practise. >> > >> > Is this really such a common problem? >> > >> >> 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 > > >> -- >> Rafael Dohms >> PHP Evangelist and Community Leader >> http://www.rafaeldohms.com.br >> http://www.phpsp.org.br >>