Stanislav Malyshev wrote:
GS>>I don't think I've ever heard Perl or C maligned on the basis of their
GS>>support for goto. Perhaps I just travel in the wrong circles.
I didn't ever saw any need in Perl goto - except for goto& construct which
isn't goto at all. As for C goto - it's usually used as replacement for
multilevel break/continue or in weird code like lexx parsers, and is
generally frowned upon on other occasions (though, of course, in places
like OS kernel code when every bit of performance counts one may need to
use goto's in numbers - but that's entirely different realm).
tools like phpDocumentor and PHP_Parser would be noticeably faster
without needing to rely upon a switch statement or the slightly faster
callback system current used. This is not an insignificant issue, as
with larger scripts, parsing time is in the order of minutes, not
seconds, and any optimization will be human-perceivable.
Perhaps PHP is the wrong language to use for parsing PHP, but writing
these tools in languages outside of PHP would take at least twice as
much time, and let's not kid ourselves: developer time is limited.
The only reason goto is abused in languages like BASIC is because the
other control structures are not useful. This is not the case in PHP.
A simple example in the manual showing proper usage of break/continue
and warning to only use goto as a last resort would be sufficient for
discouraging newbies from shooting their feet off.
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php