Hi > so you can with $foo->$bar() or $foo()
You're talking about variable functions/methods. But that is not the subject of discussion. Variable functions/methods are useful but introduce mess. This is well-known and this feature exists in PHP for a long time - so everybody should be condidered as warned - when they use it. I am talking about $this->methodName() constructions. Currently, in PHP, one can be pretty sure that if this construction works in one place - it should work in another (I mean, methodName() will exist in $this). To be mentioned - I'm not using variable functions here. 2009/11/19 Stanislav Malyshev <s...@zend.com>: > Hi! > >> If php-people really would like rebinding $this, I beleive this should >> be done via method like Closure->bindTo() - to make the fact of >> rebinding clear in the code. >> >> However, there is a problem with rebinding $this - that was not >> mentioned yet, I think. > > This can be a problem, but since PHP is not a compiled language, this > problem already exists - all method names are only checked in runtime > anyway, so it doesn't matter if you rebind the closure or not. Of course, > with rebinding you can easily shoot yourself in the foot by calling > non-existing method - but so you can with $foo->$bar() or $foo() or a number > of other ways. So I think if this construct is expressed in a way that makes > the intent clear (i.e., no implicit rebinding) then it would be OK. > -- > Stanislav Malyshev, Zend Software Architect > s...@zend.com http://www.zend.com/ > (408)253-8829 MSN: s...@zend.com > -- Regards, Victor -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php