Re: Re: PHP 6.0 Wishlist

From: Date: Wed, 24 Aug 2005 23:18:21 +0000
Subject: Re: Re: PHP 6.0 Wishlist
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-18386@lists.php.net to get a copy of this message
Michael, To your question, I don't want to encourage this style of programming. Andi At 10:24 PM 8/23/2005, Michael Walter wrote:
Zeev, On 8/24/05, Michael Walter <michael.walter@gmail.com> wrote: On 8/23/05, Zeev Suraski <zeev@zend.com> wrote:
"Real" anonymous functions (as in, closures) should be able to capture variables from its lexical environment, e.g.:
create_function() accepts a string, and that string is constructed with full access to the lexical scope of the creating function, so I'm not exactly sure how it's different. My ML/LISP memory fails me.
I misread. The obvious difference is that you're not creating code strings in ML/LISP, so (1) you can avoid all kind of error-prone marshalling and (2) you can compile the function at compile-time and simply fill out its free variables when "instantiating" the closure (using the current lexical environment), giving you syntax checks & performance. I intentionally phrased that sentence to resemble object instantiation: In fact it's pretty much the same thing with more less verbose/local syntax! I.e. as I believe you said, it is certainly *not* a question of how/whether we want that functionality, but whether we want to encourage this particular style of programming. Cheers, Michael -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#18386) next »