Re: [RFC] Allow "use( $longname as $alias)" syntax for closures declaration
| From: | Stas Malyshev | Date: | Fri, 13 Apr 2012 15:49:50 +0000 |
| Subject: | Re: [RFC] Allow "use( $longname as $alias)" syntax for closures declaration | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59884@lists.php.net to get a copy of this message | ||
Hi!
> I am not sure but it is too expensive only for memory. I don't think
> that current scope will be very big and operation for copying it very
That depends on the scope, it can be very big - e.g. global scope. But
more important is not that it is big by itself, but that it retains
variables that are otherwise to be freed and thus increases overall
memory usage.
> we don't to know what variables will be needed in future. And seems to
> me that can to detect which variables bound in closure and copy only it.
If you know any way to do it, please tell. Please account for $$var, etc.
> Many people use PHP not because it very fast and because it very simple
> to use. Syntax must be more clear for support. And using additional
> keyword for a bound with variables it's not doing it.
I don't think it's very complex syntax - you just specify the variables.
It takes 1 minute to read the manual and you know how to do it forever.
It's not the rocket science to write use($a, $b).
> At now this is there should not alter of course. What really needed is
> 'named parameters'
That's entirely different topic.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227