Re: Re: PHP 6.0 Wishlist
| From: | Michael Walter | Date: | Wed, 24 Aug 2005 05:24:13 +0000 |
| Subject: | Re: Re: PHP 6.0 Wishlist | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-18336@lists.php.net to get a copy of this message | ||
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