On 9 March 2016 at 08:30, Marco Pivetta <ocram...@gmail.com> wrote:

> On 9 March 2016 at 14:24, Pierrick Charron <pierr...@adoy.net> 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/
>
>

Reply via email to