On July 29, 2004 08:00 pm, Andrey Hristov wrote:
> Is the average Joe going to write parsers in the everydays work? Probably
> not. But give him the power of goto and (s)he is going to shoot him/her in
> the legs, in the heart, in the head. And even not only himself because
> (s)he will create a legacy code which someone else has to understand and
> fix. We have extract() and we say in the docs it is not good to use it to
> populate variables but people hack and workaround register_globals set to
> off by just using this function. IMO PHP has enough power even without
> "goto". Left aside what Dijkstra has written. goto code tends to become
> spaghetti one. Sometimes I miss it when write PHP scripts (for example
> jumping between 2 clauses in a switch, something which is used in
> var_dump() C implementation) but then I reconsider that it is better this
> way.

Parsers are just one place where GOTOs show their merit. GOTOs can be 
immensely useful error handling mechanism that can save having to make dozens 
of functions just to avoid code duplication. As I had mentioned earlier GOTO 
can be used to eliminate stack smashes caused by recursive functions that are 
the simplest solution (according to average Joe) to many problems.
IMHO just saying something can be abused does not seem like a good reason, 
because that can applied to anything. Exceptions can be abused, OO can be 
abused, xml can be abused, etc... 

Ilia

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

Reply via email to