Re: Re: PHP 6.0 Wishlist

From: Date: Wed, 24 Aug 2005 04:58:58 +0000
Subject: Re: Re: PHP 6.0 Wishlist
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-18335@lists.php.net to get a copy of this message
Zeev, 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. It certainly does not appear to be that way in PHP 4, in the supposedly equivalent snippet: function adder($a) {return create_function('$b', 'return $a+$b;');} ..$a is not accessible from inside the anonymous function. This is the reason Stanislav put the content of $a into the code string (and probably the reason he chose adder() instead of index() for his "counter-example" ;). > Since when do we consider moving towards LISP a good thing? :) FWIW, I'm merely explaining the problem, not giving any opinion (too afraid of Derick ;). Cheers, Michael PS: Common Lisps get the garbage collection right, though! ;)

« previous php.internals (#18335) next »