It may be so that you can use exceptions as a sort of goto mechanism. And from some perspective you may even find some similarities. However, exceptions weren't invented for this purpose. (And they aren't introduced into PHP for this reason.)

The main difference is that exceptions work with the *instance* of your code. (Enable you to fall back to some place in your OO structure.) Goto can't do that.




Lukas Smith wrote:
Stanislav Malyshev wrote:

No, they are not. If you don't purposedly abuse it, exceptions are a structured way to handle exceptional situations, with well-defined effects and known control points. They won't allow you to randomly jump around the code.


How is that different from "goto"?
And if you can jump through 80% if your code via an exception while you unwind the stack it might be ordered but you tell me that you know whats going on. For all intends and purposes it will be just as random, with the difference that you can search for the goto much better than for the exception handler.

Anyways I have made my case and you have made yours. We can now choose to ignore eachother :-)

regards,
Lukas

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to