On Wed, 11 Aug 2010 14:57:47 +0100, Johannes Schlüter
<johan...@schlueters.de> wrote:
On Wed, 2010-08-11 at 14:38 +0100, Gustavo Lopes wrote:
I've updated the wiki page for "Closures with objects extension" with
things that are in "Proposal A with modification"s but are not
implemented:
http://wiki.php.net/rfc/closures/object-extension#status_as_of_august_10_2010
I propose an implementation of "closures stored in properties used as
methods", as in:
$this->prop = function () { ...}
$this->prop();
[...]
I don#t have an opinion on this feature, yet, I like the current
class-based object model as reading code is relatively simple, with this
addition (and the fact that you can create properties on the fly) we
create a powerful tool for really hard to read code.
It's important to understand this is not mere syntactic sugar over
$a = $this->prop;
$a();
or call_user_func($this->prop). It actually allows executing closures in a
way that fails if the staticness or bound instance of the closure is not
what was expected.
See the beautiful tree graphs on the wiki page.
--
Gustavo Lopes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php