Re: T_AS in closures
| From: | Stas Malyshev | Date: | Wed, 05 Mar 2014 22:57:47 +0000 |
| Subject: | Re: T_AS in closures | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-72954@lists.php.net to get a copy of this message | ||
Hi!
> But this is not about something that can't be achieved with existing
> features, it's about cleaner code and to some extent - consistency
> with T_AS in foreach(), traits, namespaces; and also how regular
There's no issue of consistency there - foreach is not used to "rename
variables", foreach is used to iterate. If anything, that is opposite of
consistency, since "as" is used in two contradictory roles - for naming
iterating variable and for renaming variable without iterating.
I don't see how it's any "consistency" to add a new feature while
reusing syntax used in existing features for different purposes.
> functions would have local-scope names for variables that are passed
> to them.
Those things are called function parameters, and anonymous functions use
them the same way as named functions, no difference there either. And of
course anon functions can have local vars too.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227