Hello, On Wed, Nov 18, 2009 at 11:44 AM, Stanislav Malyshev <s...@zend.com> wrote: > I have very hard time imagining somebody that would be comfortable using > such a construct. What happened to keeping it simple? And why every tiniest > feature of every remotest imaginable use case has to be brought into the > language syntax?
That syntax made my eyes hurt, but I think really the problem is that people want to dynamically add methods with $this in the closure pointing the the object it has been attached too. Really I like A. but can see cases for rebinding (C). Maybe a magic method like __attach(string methodName, function method) that would rebind $this in closures would be a solution. But it would be the first magic method I can think of that isn't overridden by the defining class. $o = new StdClass; $o->bar = 'bar'; $o->__attach('foo', function() { echo $this->bar; }); $o->foo(); // bar Just a thought. -Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php