Functionally, create_function() is a variation of eval, which allows
you to create new code at runtime. Static lambda is syntactic sugar
for creating a function in the global scope, without knowing its name
at compile time. Static lambda is more restrictive than

While we are at it, what's wrong with knowing the name? I can see why closure can be fun when you can dynamically use outer-scope variables. But when you can't, what exactly prevents one from just doing the function?

two considerations to take here; First, how probable is it, that users
will make this assumption? And second, how much confusion will it
cause to those, which it affects?

First, about 100% on the first encounter for any user ever seeing closures in any other language. Second, all the confusion possible, like "oh, closures! cool! let me do this and that! what, I can't use variables?! Are you kidding me?! WTF is it useful for?!"

place. The simple rule, that PHP has dynamic scope, should be simple
to understand for anyone who actually knows the difference.

I'm not sure I understand what you mean by "static scope" and "dynamic scope", but anyway thing that looks like closure but works like regular function definition that isn't - is not a very good idea, IMO.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to