Hi!
some time back (August 08) I complained about 'use' being at a weird
position and not at the same place as 'global' or 'static' where I
expected it. Back then Dmitry asked me to provide a patch to check out
the alternative. Now during the holidays I finally found some time to
change from:
$f = function() use ($x) {}
to:
$f = function() { use $x; }
Patch is attached.
Comments?
I don't really see any "consistency" in it - this "use" syntax has
nothing to do with other "use" (namespace one) even if it looks almost
exactly like one in proposed patch. It also is subtly different from
global or static - different enough to make people think "ok, 'global'
is always by ref and 'use' looks like 'global' for consistency reasons -
does it mean it is consistently by-ref?" Not to mention questions like
"can I write 'use' in the middle of the code, since I can do it with
"consistent" constructs like 'static' or 'global'? What if I refer to
the variable before - will it be already bound?", etc. I think it would
not improve code readability and not really make it "consistent" anyway.
--
Stanislav Malyshev, Zend Software Architect
s...@zend.com http://www.zend.com/
(408)253-8829 MSN: s...@zend.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php