Re: GOTO operator
| From: | Ilia Alshanetsky | Date: | Fri, 30 Jul 2004 13:12:35 +0000 |
| Subject: | Re: GOTO operator | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11664@lists.php.net to get a copy of this message | ||
On July 30, 2004 02:43 am, Andi Gutmans wrote:
> At 04:55 PM 7/29/2004 -0700, Sara Golemon wrote:
> I think there are only two cases where goto is really interesting:
> a) Error handling.
> b) Auto-generating code or compiler compilers (Sterling mentioned these
> two).
c) Anywhere recursive functions are being used.
d) small loop inlining
There are other applications as you had yourself mentioned, ultimately goto is
a construct that can be used for both good & bad code. But that can be said
for many of PHP's features that no one even suggests removing.
> Yes, any programmer can shoot himself in the foot with other PHP features,
> but we do have a responsibility to minimize that. One example is our
> introduction of E_STRICT. We don't warn about enough things but we do try.
> Why give our developers yet another way of shooting themselves in the foot?
> Or should I say, blow off their leg? :)
If we really want to protect the user from themselves perhaps we should limit
the user to addition and subtraction between the values of 1 and 100. That is
ultimately what would become a language designed for the lowest common
denominator.
You can already do some pretty wild things without triggering any notices with
perfectly valid and even working code. But that code will be 100% unreadable
let alone maintainable adding gotos will unlikely to change that in any
significant way.
While without a doubt some people will abuse GOTO there are plenty of
developers who'd put it to good use in their application, perhaps utilizing
it ways we haven't even considered yet. If anything this discussion had
proved that there is much support/need for GOTOs in both PHP developer and
user communities.
Ilia