Re: [PATCH] [RFC] Closures and lambda functions in PHP
| From: | Rodrigo Saboya | Date: | Thu, 19 Jun 2008 15:36:03 +0000 |
| Subject: | Re: [PATCH] [RFC] Closures and lambda functions in PHP | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-38411@lists.php.net to get a copy of this message | ||
Dmitry Stogov escreveu:
I don't like "lexical" keyword, because it can be used anywhere in function (e.q. inside "if" or loop statement), however lexical variables must be the part of lambda function definition.I agree with Dmitry: Lexical variables belong to lambda function definition. It makes more sense to me. But I also agree that the proposed syntax might be a little misleading.
We can think about some better syntax, like function ($x, $y) ($a, $b, $c) {};This looks better
function ($x, $y) [$a, $b, $c] {};Array confusion is to be expected with this syntax, I don't like it. FWIW, I'd like to see this on 5.3. regards Rodrigo Saboya
I like "|" separator more, but the syntax of definition is not so important for me. It just must be clean, and the "lexical" keyword doesn't provide clean definition. I don't like the idea to add methods at runtime, as it can break shared data structures in multi-threaded environment. Thanks. Dmitry.