Re: Continued try blocks
| From: | Lazare Inepologlou | Date: | Fri, 26 Apr 2013 15:22:42 +0000 |
| Subject: | Re: Continued try blocks | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67169@lists.php.net to get a copy of this message | ||
2013/4/26 Julien Pauli <jpauli@php.net>
> 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();*
> *}*
>
>
This seems like a BC break:
for ( ; ; ) {
try {
...
} catch (Exception $e) {
continue;
}
}
With the proposed syntax, "continue" will no longer refer to the "for" loop..
>
>
> 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
>
Lazare INEPOLOGLOU
Ingénieur Logiciel