Re: GOTO operator
| From: | David Chen | Date: | Sun, 01 Aug 2004 17:51:32 +0000 |
| Subject: | Re: GOTO operator | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11791@lists.php.net to get a copy of this message | ||
"Michael Walter" <cm@leetspeak.org> wrote in message
news:410C4633.40804@leetspeak.org...
> Another possibility, possibly more concise, would be to introduce a
> "scoped" keyword (or similar) in the spirit of "global":
>
> scoped $foo;
>
> might make $foo's destructor be called at the end of the current scope
> (whether left by a return statement or by an exception).
>
> Note that this only solves one part of the problem which could be
> summarized as "resource management". I'm not sure about generated code -
> did someone already post an example where goto might be useful in that
> case or did I miss that one?
Considering that some don't accept exceptions to be a valid alternative to
gotos, I don't think they'll accept a clearly OOP solution. And yes, I'm
also still waiting for a code-generation example, but I guess we'll just
assume that gotos are useful there (I use JavaCC, a Java-based top-down
generator, so yes there's a lot of recursion but it looks pretty clean to
me).
David Chen