Hello Nate, Wednesday, March 11, 2009, 9:25:23 PM, you wrote:
> Hi all, > Since around alpha1, I've been doing some experimenting with closures, > most recently in the form of a filter chain implementation, and I've > discovered that as of beta1 (as was noted in the "removal-of-$this" > RFC) that there is no way to access private or protected members of > any class inside a closure, regardless of where it is defined. > I realize that the question of implicit $this support for closures has > already been discussed and decided upon temporarily (and I certainly > have no wish to rehash it again), however, it seems logical that even > without being bound to an object, closures should still inherit the > scope in which they're defined. Otherwise, this creates a confusing > inconsistency within the language. At the moment it simply is impossible to allow $this. Simply becasue we could not solve resolving it correctly, or figuring out the scope correctly. An attempt of mine to solve the issues first looked good and then just brought up more issues and the only way to solve them was to make everything slower. So we decided to keep closures as external entities that are not bound to the scope they are created in. In the same way we do not bind anythign magically. Also it appears that you probably want a real callback if you ave to access private or protected members. At least from a pure design stanpoint that is more than obvious. Please leave it for the moment, we are far to close in PHP 5.3 release process to do somethign about it now. Best regards, Marcus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php