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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to