RE: [PHP-DEV] PHP 5.1
| From: | Derick Rethans | Date: | Mon, 06 Jun 2005 12:05:29 +0000 |
| Subject: | RE: [PHP-DEV] PHP 5.1 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16420@lists.php.net to get a copy of this message | ||
On Mon, 6 Jun 2005, Stanislav Malyshev wrote:
> DR>>We're only talking about a goto that:
> DR>>- can only jump to a static label
> DR>>- can only jump inside the current scope
> DR>>
> DR>>With a parameterized break/continue you still can't just to the "end"
> DR>>of
> DR>>your function to do clean ups (unless you wrap it in a control block
>
> finally construct should do that, I think. IMO that's the right solution,
> not goto's - and anyway if you allow goto only inside same block, what if
> error condition happens inside other block? Are all your functions flat
> without control blocks? What if exception happens - are you not going to
> clean up then?
exceptions and goto don't mix in the first place. goto can be used to
emulate exceptions in non-OO code.
> Using control blocks is no more ugly than using goto's - and thr right way
> to do it is using exception handling and finally, IMO.
IMO exceptions make more possibilities for spagetti code as you can use
them to bubble out of the current scope. Also, exceptions are a no-no in
procedural code.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org