Re: resume after exception
| From: | Stas Malyshev | Date: | Thu, 05 Apr 2012 23:47:39 +0000 |
| Subject: | Re: resume after exception | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59359@lists.php.net to get a copy of this message | ||
Hi!
>> While exceptions themselves may not be suitable for a general-purpose
> control structure, they do embody one. It's an early-return mechanism that
> you also see in some of the other control structures mentioned in this
> thread (Python's generators, Common LISP's conditions). Even the "return"
You can do the same generators do using iterators in PHP. You'll have to
store state a bit more explicitly, but otherwise it'd be pretty much the
same, as far as I can see.
However, in general, thinking about more complex flow control structures
in fine. Just there's no reason to get exceptions mixed into it.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227