Re: [PATCH] [RFC] Closures and lambda functions in PHP
| From: | Stanislav Malyshev | Date: | Wed, 18 Jun 2008 18:29:09 +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-38361@lists.php.net to get a copy of this message | ||
Hi!
by reference ($GLOBALS["foo"] =& $var). Now that I think of this example I'd actually prefer to see $LEXICALS[] or something similarThe problem here might be that if we do something like $LEX[$foo] in runtime, we don't know which parts of parent's scope we need to preserve. While I like the syntax, it may not work this way. Which brings me to another point - how bad would it be if closure's lifetime would be limited to parent's lifetime? Of course, this would limit some tricks, but would allow some other - like this direct access to parent's scope.
- Minor implementation suggestion: I am not sure we need those flags for closures and have those if() statements before function calls. WeIn any case I think we don't need to waste 2 bytes (or more with alignment) on something that's essentially 2 bits. I know it's nitpicking, but every little bit helps :) Of course, if we drop the flags the point is moot. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com