I've been reading up on some of the parts of PHP that has been suggested
could be improved so that I could be more well informed. One of the
more "interesting" (for lack of a better word) suggestions is closures.
I've used closures primarily in JavaScript, and they are handy in that
context, but JavaScript handles events and other more dynamic situations
like that.
I can't really think of any good examples of why I'd want to use a
closure instead of just calling functions or class methods in PHP.
Variable functions and call_user_func*() have worked for any of the
cases where I did need to be a bit more dynamic.
I found a great summary of some discussion on the internals mailing list
over here: http://devzone.zend.com/node/view/id/2013#Heading1
After reading that article through, I do like Wez's idea of how to
create anonymous functions. The point about it causing confusion with
people coming from other languages definitely applies though. This
article also gives me a second idea for this post. How many people
would want closures in PHP?
In summary:
Would you want closures in PHP, and why?
--
Ray Hauge
www.primateapplications.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php