Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91589 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74298 invoked from network); 9 Mar 2016 13:35:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2016 13:35:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierrick@webstart.fr; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pierrick@webstart.fr; sender-id=unknown Received-SPF: error (pb1.pair.com: domain webstart.fr from 209.85.161.172 cause and error) X-PHP-List-Original-Sender: pierrick@webstart.fr X-Host-Fingerprint: 209.85.161.172 mail-yw0-f172.google.com Received: from [209.85.161.172] ([209.85.161.172:34215] helo=mail-yw0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/D3-53667-3B620E65 for ; Wed, 09 Mar 2016 08:35:48 -0500 Received: by mail-yw0-f172.google.com with SMTP id h129so39485388ywb.1 for ; Wed, 09 Mar 2016 05:35:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=webstart-fr.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=j0Ihh9P9UU7CVrHtojLG4PtVEFBfB4JqqJGBk7VCkio=; b=mPGXqIA1hHdiyj3YTmQ0YcqDBgoATbc9WQ3BAXIlItipOm4Hk+F8mwALpTvWzcsNp8 UT8cGW9Ds4qWeldU2S09x1JtCe41eg1H08g1u4YnrxmMb0HpN24qMWBSS6BwUreNgfES Iq8NbNNJUzsEtgt/w9kRyzrLF3VC8iZ//G6MlThcJ/PeRwkni4iaCcjchaKyRh+70fE0 tZvKNuJ1QXkPOjhhLxrfAWdyuaou9ezqy/A4dw/OW7060NMZc4/YGA2vJ6w5kCdY60y9 2rZFhA1DKXLlb+2+JgEEtUMAq12XByoLb05cLttMxgqfZ/vUFnnW0ZFvEnrhk4w5DJlG 0ayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=j0Ihh9P9UU7CVrHtojLG4PtVEFBfB4JqqJGBk7VCkio=; b=id38ySrN6xsu5dVMZhd+lavDssw3gmOFGL6ry53ZrE56jR+Du+pOoxgi1aIB2O+IMB ieZZSbdeSXjNWP+i9LhwnYtD/FYLe4puDpI/UbmRplh1Sro06onXEPGJhwmiGZ7xJufv hpfqNq/CNtBXkHd8Kk0OG4e+b3x2b/kMGPvvWAlDADQukMai5fBJRI2YlAMGByHtU4x2 qb7r723HLNfcR9UaR3n1ph8IOs8BU0qUz1ywGtE/AG4HzOYqZWsIKyacArx7GkM8NdJx F//H8iCaOJqnWYDBJkZZ0ZHqEU37DjBGUE9kmkjJAxHu/GiuJ7xDrIfsLPIg3uDiLZxG fFiQ== X-Gm-Message-State: AD7BkJIvkcA5WFKcTV+59lUcWOysP6gQvqlLUQGNcNQZACc0wFMfuZODZBi8QbTgFVrOae9hUdVctKC/Fntjuw== MIME-Version: 1.0 X-Received: by 10.13.245.4 with SMTP id e4mr20334417ywf.11.1457530545374; Wed, 09 Mar 2016 05:35:45 -0800 (PST) Sender: pierrick@webstart.fr Received: by 10.37.76.130 with HTTP; Wed, 9 Mar 2016 05:35:45 -0800 (PST) In-Reply-To: References: Date: Wed, 9 Mar 2016 08:35:45 -0500 X-Google-Sender-Auth: 6hGR8bzj8zYAmgjJSwqgwPjBzdw Message-ID: To: Marco Pivetta Cc: Derick Rethans , PHP internals , =?UTF-8?B?QnJvbmlzxYJhdyBCaWHFgmVr?= Content-Type: multipart/alternative; boundary=94eb2c08650e688a2a052d9dc687 Subject: Re: [PHP-DEV] [RFC Discussion] Catching multiple exception types From: pierrick@adoy.net (Pierrick Charron) --94eb2c08650e688a2a052d9dc687 Content-Type: text/plain; charset=UTF-8 On 9 March 2016 at 08:30, Marco Pivetta wrote: > On 9 March 2016 at 14:24, Pierrick Charron wrote: >> >> The thing I don't like about this approach is that I have to read the >> code and double check to make sure that the catch statement call the same >> method. >> For the amount of work that needs to be done in the Engine (see the patch >> attached to the RFC) this is far more readable and it is clear that the >> code to handle those 3 exceptions is the exact same one. And if the code of >> handleFailure is small you can even put it at this single place. >> >> public function stuff() >> { >> try { >> $this->willFail(); >> } catch (FirstException | SecondException | ThirdException $e) { >> $this->handleFailure($e); >> } >> } >> >> > I'd still have to write 3 test cases anyway: no real amount of > code-savings there. > Agree > > I still think the first solution is as readable as the one you proposed > there. > Agree to disagree ;-) > The change in the PHP engine might be trivial, but the syntax change from > a userland perspective is a mess (tooling, pretty much anything that relies > on an AST parser needs changes there). > Do not underestimate language changes as a php-core only issue. > You're right but I think those impact should not prevent us to make the language evolve even for small changes that are just like this one syntactic sugar. With the amount of user doing PHP code on a daily basis those changes are IMO worth it. > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > --94eb2c08650e688a2a052d9dc687--