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

From: Date: Sat, 05 Jul 2008 19:47:37 +0000
Subject: Re: [PATCH] [RFC] Closures and lambda functions in PHP
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-38779@lists.php.net to get a copy of this message
Hello Stanislav, Monday, June 30, 2008, 12:20:15 AM, you wrote: > Hi! >> * 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. > And to close the circle, add __invoke to ReflectionFunctionAbstract and > implement it in Reflectionfunctiom and ReflectionMethod (here we might > have trouble with specifying object, so need to do some thinking on it - > maybe we'll need another class or augment ReflectionMethod somehow?) Actually a pretty good idea :-) Callable comes to mind if we really need more names. But a ReflectionMethod could be a static method as well as a static closure. So I think it should throw an exception in case an instance is missing, just as it would do for non static methods. marcus >> echo $view->escape("<script>alert(1)</script>"); > If we use this syntax, and $view->escape is not defined, should we call > __call or __get? > -- > Stanislav Malyshev, Zend Software Architect > stas@zend.com http://www.zend.com/ > (408)253-8829 MSN: stas@zend.com Best regards, Marcus

« previous php.internals (#38779) next »