Re: Continued try blocks

From: Date: Fri, 26 Apr 2013 14:46:05 +0000
Subject: Re: Continued try blocks
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Sounds interesting. And what about the second attempt passing the try block
without goto?


2013/4/26 Julien Pauli <[email protected]>

> Hello internals,
>
> I had an idea recently with a friend, about a feature try-catch blocks
> could use.
> Let me just write an example, you will quickly understand the idea :
>
> *<?php*
> *
> *
> *try {*
> *   foo();*
> *   bar();*
> *   baz();*
> *} catch (SomeException $e) {*
> *    dosomestuff();*
> *    continue; /* Here is the feature, go back to try block */*
> *} catch (Exception $e) {*
> *    dosomething();*
> *}*
>
>
>
> The continue keyword would resume the execution from where it had
> diverged, according to the function which led to the SomeException
> catch block.
>
> So, in this example, if, say, bar() throws a SomeException , the code
> would then resume and execute baz() after the catch block.
>
> Just presenting the idea here, no RFC actually , I'm collecting
> thoughts and notices.
>
> Julien.Pauli
>


Thread (33 messages)

« previous php.internals (#67168) next »