# Removing Try and Catch

- Thread: https://externals.io/message/11658
- Original archive: https://news-web.php.net/php.internals/11658
- Started by Stefan Esser on 2004-07-30T08:24:39+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #11658 — Stefan Esser — 2004-07-30T08:24:39+00:00

URL: https://externals.io/message/11658#11658

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

---

## #11685 — Marcus Boerger — 2004-07-30T17:56:01+00:00

URL: https://externals.io/message/11658#11685 · In reply to: #11658

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

---

## #11704 — Johannes Schlueter — 2004-07-30T18:48:03+00:00

URL: https://externals.io/message/11658#11704 · In reply to: #11685

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
