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


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

Reply via email to