Re: PATCH: anonymous functions in PHP

From: Date: Mon, 19 Mar 2007 22:33:31 +0000
Subject: Re: PATCH: anonymous functions in PHP
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-28467@lists.php.net to get a copy of this message
Can't you just take the body of "create_function" with the syntax of the patch, and marry those two?
Well, that'd be a bit hard since the whole difference is that create_function is runtime (thus having access to run-time values) while anon-func we are trying to do here is compile-time (at least it makes a lot of sense to do it compile-time). We could of course just leave the scope thing alone and say "want access to other scope? tough luck, use create_function/eval or globals".
How does the current create_function handle this same scope issue?
It doesn't AFAIK :) Since it's a close relative of eval, it can import values of variables by inserting ones into function string, but nothing more (i.e. you couldn't put an object there, and couldn't refer to a variable - only insert it's value). -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

« previous php.internals (#28467) next »