On Jun 7, 2005, at 8:12 AM, Stanislav Malyshev wrote:

GS>>And yet it exists and people use it productively - so you've
GS>>successfully undermined your own argument (and Perl's goto is far more
GS>>flexible|evil than the one proposed for PHP).

Care to give example where it is really needed and can't be trivially
reduced to labeled break?

Perl's goto has a number of features that the proposed one does not, for instance the ability to jump out of scope. This is necessary when using AUTOLOAD in Perl for altering the callstack to not reflect that you were just in AUTOLOAD, but were in the overloaded function instead. It's a standard (albeit advanced) Perl idiom.

Very few things are really unnecessary. Is the functionality supported by ifsetor() necessary? Is the ability to use assignments in conditionals necessary? Is the existence of switch() as a language construct really necessary? All of these can be trivially implemented with other language primitives. PHP is full of syntactic sugar that makes common tasks easy, and gives people the ability to solve problems in the way they see fit.

The point isn't whether or not you see Perl (or C's) goto as useful or not. The point is that other people do, and neither has caused the ruinous demise of either language.

As for my own example, many state machines make extensive use of goto to avoid recursive calls.

George



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

Reply via email to