Hiho,

Paul G wrote:
----- Original Message ----- From: "Andi Gutmans" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, July 30, 2004 2:08 PM
Subject: Re: [PHP-DEV] GOTO operator


--- snip ---


I'm sorry but I just don't understand the great need for goto in PHP and
that is coming from someone who does see the need in C.


presumably, you see the need in C because it's the cleanest way to free()
all you've malloc()ed along the way, regardless of where you've errored out.
in PHP, you've got gc, which (again presumably) makes you think we don't
need goto. i say that we alloc() stuff quite often, but it may be objects,
resources, what have you instead of chunks.
It's interesting that there is the desire for a low-level construct such as "goto" in order to implement scoped deallocation/deconstruction. I suppose something like C#' using() statement might help you in this case, although suggesting it will surely lead to another discussion ;)

Cheers,
Michael


yes, you can emulate it, but none of the emulations work equally well, ie you need to update N lines of code when you add another alloc()ed resource, error condition etc. error handling is not at all uncommon (at least it shouldn't be =), quite a bunch of code is still procedural, more procedural code is being written, and there is nothing wrong with that either in the majority of cases (ie it works well for what is being done).

paul


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



Reply via email to