Re: [PATCH] [RFC] Closures and lambda functions in PHP

From: Date: Tue, 24 Jun 2008 07:19:27 +0000
Subject: Re: [PATCH] [RFC] Closures and lambda functions in PHP
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-38562@lists.php.net to get a copy of this message
Hey How are we going to deal with Closures in class properties, like: class PHP { public $closure; public function __construct($callback) { $this->closure = $callback; } public function closure() { echo 'PHP::closure'; } } $closure = function() { echo 'PHP::$closure'; }; $test = new PHP; Now calling $closure->closure(); whats going to happen? I would assume it executes the method first if and if there aren't a method with the name it will execute the $closure property? Another subject I would like to see now the closures has been brought up again is, how about adding type hinting in method/function prototypes: function call(function $callback) { $callback(); } call(function(){ echo 'Hello'; }); We could make reuse of the function keyword in the prototypes which saves us from adding another keyword to the language. Cheers, Kalle

« previous php.internals (#38562) next »