Re: [RFC] Closures, Lambdas and use
| From: | Stanislav Malyshev | Date: | Mon, 05 Jan 2009 05:03:56 +0000 |
| Subject: | Re: [RFC] Closures, Lambdas and use | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42478@lists.php.net to get a copy of this message | ||
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: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 stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com$f = function() use ($x) {}to:$f = function() { use $x; }Patch is attached. Comments?