Removing Try and Catch

php.internals

Stefan Esser

22 years ago
Hi, okay lets remove GOTO and of course also remove try,catch. You can emulate the whole try/catch thing with lots of unreadable do/while/break statements. So why insert a stupid construct, that can only help the developers to shoot themself in the foot. Stefan

Marcus Börger

22 years ago
Hello Stefan, i thought of ignoring all of this thread but you didn't let me. Exceptions are neccessary for constructor failure and there is no other way to do it. BUT even though goto is needed for non oo generator code (compiler compilers etc.) it is a dangerous thing that basically promotes spagetti code. marcus Friday, July 30, 2004, 10:24:39 AM, you wrote:
> Hi,
> okay lets remove GOTO and of course also remove try,catch. You can > emulate the whole try/catch thing with lots of unreadable do/while/break > statements. So why insert a stupid construct, that can only help the > developers to shoot themself in the foot.
> Stefan
-- Best regards, Marcus mailto:helly@php.net

Johannes Schlueter

22 years ago
Hi Marcus, Marcus Boerger wrote:
> i thought of ignoring all of this thread but you didn't let me. > Exceptions are neccessary for constructor failure and there is no > other way to do it.
So what about removing constructors, too? $object = new class; if (!$object->init()) die; (no, this wasn't serious)
> BUT even though goto is needed for non oo > generator code (compiler compilers etc.) it is a dangerous thing > that basically promotes spagetti code.
But goto can also create cleaner code and other PHP features can be abused, too. I'm sure no one here who wants PHP to be a second Perl ;-) In particular for small shell scripts, where I don't want to use OO it can be quite usefull to me, and if it is documented properly I think it wouldn't do that much harm - some people already write ugly, unreadable code, this is possible without goto. johannes