On 22.07.2008, at 13:04, Lukas Kahwe Smith wrote:
1) Closures on class properties just don't work, the only way to do
it is
to do something like:
$c = $a->b;
$c();
Calling: $a->b(); will result in method A::B() does not exists.
would be nice to get this fixed, but at worst it should be documented.
2) Closures can be defined as constants values because of its
toString method:
define('Closure', function(){ echo 'Test'; });
echo constant('Closure'); /* (string) Closure object */
3) Since Closures have this toString method, but its not showing up
in Reflection:
Reflection::export(new ReflectionClass('Closure'));
so do we even want the toString() method?
4) var_export() and Closures is useless, any call to var_export()
like the example
below will all be the same:
$lambda = function()
{
echo 'Λ Lambda';
};
var_export($lambda);
/*
Closure::__set_state(array(
))
*/
Maybe it could return some relevant information for exporting the
closure across
data
not a huge biggy to me.
5) Its impossible to clone a closure using the cloning keyword:
$a = function(){};
$b = clone $a;
This makes it hard to make a copy of the closure because of objects
always are
passed by reference.
I guess this is a draw back from the OO approach (rather than the
original resource approach), but solvable?
regards,
Lukas Kahwe Smith
[EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php