On Fri, 07 Oct 2011 18:31:42 +0100, Ferenc Kovacs <tyr...@gmail.com> wrote:
do we have a wiki/documentation about what exactly ended up in 5.4
from the Closure improvements? (Rebind)
https://wiki.php.net/rfc/closures/object-extension#privateprotected_members_scope
is really hard to read, as it contains all of the suggested ideas and
possible solutions, etc.
if not, maybe someone with the required knowledge could start working
on adding the documentation?
I don't think so, but if I had to summarize the innovations in 5.4, this
would be it:
- Closures can now have an associated scope
- Closures can now have a bound object
- Closures can now be either static or non-static
- Closures defined in a place with an active scope are scoped accordingly
- Closures defined inside an instance method (or bound closure) have a
bound object (namely $this)
- Closures are static if defined within a static method or with the static
keyword (static function() { ... })
static => !bound
(but it's false that !static => bound)
bound => scoped
!static && scoped => bound
(i.e., if !static, scoped <=> bound)
The bound instance and the scoped can be freely changed with Closure::bind
and $closure->bindTo, subject to these constraints.
--
Gustavo Lopes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php