Re: [PHP-DEV] [RFC] Closures, Lambdas and use

2009-01-05 Thread Stanislav Malyshev
Hi! We have the same with global and static. Can you write them in the middle of a funciton/method? So asking for what the consequence is, is irrelevant Yes you can. Example: ?php $a = 1; function foo() { $a = 2; echo $a; global $a; echo $a; } foo(); that it would break most PHP

Re: [PHP-DEV] [RFC] Closures, Lambdas and use

2009-01-05 Thread Larry Garfield
On Mon, 5 Jan 2009 11:21:56 +0100, Marcus Boerger he...@php.net wrote: What is left is moving something we decided upon so that it might look like something that is similar already avoiding to create a pretty new syntax that in my opinion is unnecessary different from anything we already

Re: [PHP-DEV] [RFC] Closures, Lambdas and use

2009-01-05 Thread troels knak-nielsen
On Sun, Jan 4, 2009 at 10:05 PM, Larry Garfield la...@garfieldtech.com wrote: $f = function($a, $b) use ($y, $z) global ($x, $w) { It would still leave the static keyword as an outlier. It wouldn't make sense to declare a static by-ref. Another problem with this, is that use and global doesn't

Re: [PHP-DEV] [RFC] Closures, Lambdas and use

2009-01-05 Thread Marcus Boerger
Hello Stanislav, Monday, January 5, 2009, 6:03:56 AM, you wrote: 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

Re: [PHP-DEV] [RFC] Closures, Lambdas and use

2009-01-04 Thread Sebastian Bergmann
Marcus Boerger schrieb: $f = function() { use $x; } +1 for consistency. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69 -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] [RFC] Closures, Lambdas and use

2009-01-04 Thread Larry Garfield
On Sunday 04 January 2009 8:17:27 pm Marcus Boerger wrote: Hello Larry, $f = function() use ($y, $z) { global $x; // By reference } $y is clearly by value, and $z clearly by reference, as that parallels the way function parameters work right next to the lexical variables.

Re: [PHP-DEV] [RFC] Closures, Lambdas and use

2009-01-04 Thread Stanislav Malyshev
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: