Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
by Lars Strojny other posts by this author
Jun 29 2008 3:06PM messages near this date
Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
|
Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
Hi Christian,
thanks again for your (and Dmitry's) great work on making closures a
part of PHP.
Am Donnerstag, den 26.06.2008, 18:23 +0200 schrieb Christian Seiler:
> * I have *not* added any __invoke() magic to normal objects. This is
> mainly due to the simple reason that adding that would not help
> a closure implementation at all. Closures need some engine internal
> magic (use a dynamically created op_array instead of looking one up,
> setting the correct class scope and setting the correct EG(this). And
> as I said: I want to stick with the closure basics for now.
I understand that you want to keep your proposal basic. However I have
the feeling that we need a complete implementation to make closures
really beneficial for our users. I would consider the following features
to be central for a feature complete implementation:
* Class::__invoke() to allow functors[1]. The class "Closure" in
your proposal should also implement that method to make
method_exists() and ext/reflection behave.
* Change the behaviour how method calls are resolved. Method calls
on invokable objects (closures or functors) should work.
cu, Lars
[1] http://en.wikipedia.org/wiki/Functor
[2] Example for a closure assigned to a property:
class View();
{
public $escape;
}
$view = new View();
$view-> escape = function($string) {
return htmlentities($string, ENT_QUOTES, 'UTF-8');
}
echo $view-> escape("<script>alert(1)</script>");
Thread:
Christian Seiler
Wez Furlong
Dmitry Stogov
Stanislav Malyshev
Alexander Wagner
Dmitry Stogov
Andi Gutmans
Christian Seiler
Lukas Kahwe Smith
Sebastian Bergmann
Marcus Boerger
Markus Fischer
Troels Knak-Nielsen
Christian Seiler
Dmitry Stogov
Larry Garfield
Christian Seiler
Dmitry Stogov
Christian Seiler
Lars Strojny
Stanislav Malyshev
Marcus Boerger
Lars Strojny
Troels Knak-Nielsen
Larry Garfield
Marcus Boerger
Dmitry Stogov
Andi Gutmans
Alexander Wagner
Andi Gutmans
Alexander Wagner
Alexander Wagner
Christian Seiler
Alexander Wagner
Lars Strojny
Dmitry Stogov
Marcus Boerger
Lars Strojny
Dmitry Stogov
Alexey Zakhlestin
Federico Lebron
Dmitry Stogov
Rodrigo Saboya
lenar
Larry Garfield
Stanislav Malyshev
Marcus Boerger
Alexander Wagner
Lars Strojny
Larry Garfield
Robert Cummings
Rodrigo Saboya
Alexander Wagner
Christian Seiler
Chris Stockton
Alexander Wagner
Troels Knak-Nielsen
Andi Gutmans
Marcus Boerger
Christian Seiler
Lukas Kahwe Smith
Gwynne Raskind
Andi Gutmans
Christian Seiler
Stanislav Malyshev
Kalle Sommer Nielsen
Troels Knak-Nielsen
Lars Strojny
Alexander Wagner
Stanislav Malyshev
Alexander Wagner
Andi Gutmans
Marcus Boerger
Kalle Sommer Nielsen
Troels Knak-Nielsen
Stanislav Malyshev
Alexey Zakhlestin
Chris Stockton
Alexey Zakhlestin
Gwynne Raskind
Stanislav Malyshev
Christian Seiler
Gwynne Raskind
Stanislav Malyshev
Richard Quadling
Christopher Jones
Marcus Boerger
Steph Fox
Christian Seiler
Marcus Boerger
Stanislav Malyshev
Lars Strojny
Christian Seiler
Stanislav Malyshev
Marcus Boerger
Marcus Boerger
Andrei Zmievski
Stanislav Malyshev
Stanislav Malyshev
Alexey Zakhlestin
Chris Stockton
Christian Seiler
Christian Seiler
Larry Garfield
Edward Z. Yang
Christian Seiler
Larry Garfield
Christian Seiler
Nathan Nobbe
Christian Seiler
Alexey Zakhlestin
Larry Garfield
Philip Olson
|