Re: resume after exception
| From: | Anthony Ferrara | Date: | Mon, 02 Apr 2012 21:34:04 +0000 |
| Subject: | Re: resume after exception | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59330@lists.php.net to get a copy of this message | ||
Sam,
I'm not saying it's a good idea, but this would allow for pythonic
style generators. http://wiki.python.org/moin/Generators
Just pointing out one potential use-case...
Anthony
On Mon, Apr 2, 2012 at 4:35 PM, Samuel Giles <sam.e.giles@gmail.com> wrote:
> Hi Internals
>
> function test()
>> {
>> echo "Begin Test!\n";
>>
>> throw new Interrupt();
>>
>> echo "Execution resumed!";
>> }
>>
>> try
>> {
>> test();
>> }
>> catch (Interrupt $e)
>> {
>> echo "Execution interrupted.\n";
>> resume;
>> }
>>
>> The output of this would be:
>>
>> Begin Test!
>> Execution interrupted.
>> Execution resumed!
>>
>
> My major concern would be, how does this* really* add to PHP? Perhaps I'm
> missing the point, but what would this allow that can't be done in some
> form using well defined "patterns", for lack of a better word.
>
> I'm not keen on the idea of throwing things such as Interrupts either, it
> doesn't quite fit with their general use case.
>
> Sam