Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-06 Thread Stanislav Malyshev
Hi! function replace_spaces ($text) { static $replacement = function ($matches) { return str_replace ($matches[1], ' ', 'nbsp;').' '; }; return preg_replace_callback ('/( +) /', $replacement, $text); } That is using static would result in creating the function

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-05 Thread Marcus Boerger
Hello Christian, cool progress and nice syntax. The only thing I was wondering of is whether the following would work: function replace_spaces ($text) { static $replacement = function ($matches) { return str_replace ($matches[1], ' ', 'nbsp;').' '; }; return

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-04 Thread Johannes Schlüter
Hi, On Thu, 2008-07-03 at 22:30 +0400, Dmitry Stogov wrote: I don't see big problems with closures. The patch is simple and stable. It's main part isolated in zend_closures.c and it doesn't affect other parts of engine. Changes too the languages always introduce some side effects and

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-04 Thread Lars Strojny
Hi Johannes, Am Freitag, den 04.07.2008, 11:18 +0200 schrieb Johannes Schlüter: Now such a check isn't possible, all reflection information on the callback I can get is that it is an object of type Closure having a method __invoke() with zero required parameters. There's no further

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-04 Thread Johannes Schlüter
On Fri, 2008-07-04 at 11:31 +0200, Lars Strojny wrote: Hi Johannes, Am Freitag, den 04.07.2008, 11:18 +0200 schrieb Johannes Schlüter: Now such a check isn't possible, all reflection information on the callback I can get is that it is an object of type Closure having a method __invoke()

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-04 Thread Daniel Convissor
On Thu, Jul 03, 2008 at 10:30:43PM +0400, Dmitry Stogov wrote: I don't see big problems with closures. The patch is simple and stable. While you're probably right, it seems there is still lots of discussion about how closures should work. It seems better to get this right in a later version

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-03 Thread Dmitry Stogov
Hi Lukas, From my point of view the proposed closures concept is very consistent and implementation doesn't complicate the engine at all. The code without closures will work without any changes, but code with closures (instead of eval() and create_function()) will work significant faster as

[PHP-DEV] PHP 6 (and forget 5.4) (Was: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch)

2008-07-03 Thread Derick Rethans
On Wed, 2 Jul 2008, Lukas Kahwe Smith wrote: On 02.07.2008, at 13:41, Christian Seiler wrote: So as things look atm, closures will have to wait until then. But cool features like closures, traits etc will undoubtedly increase the incentive to get working quickly on 5.4 and this can happen

Re: [PHP-DEV] PHP 6 (and forget 5.4) (Was: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch)

2008-07-03 Thread Lester Caine
Derick Rethans wrote: On Wed, 2 Jul 2008, Lukas Kahwe Smith wrote: On 02.07.2008, at 13:41, Christian Seiler wrote: So as things look atm, closures will have to wait until then. But cool features like closures, traits etc will undoubtedly increase the incentive to get working quickly on 5.4

Re: [PHP-DEV] PHP 6 (and forget 5.4) (Was: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch)

2008-07-03 Thread Dmitry Stogov
Absolutely agree. I don't see any reason for 5.4. We don't plan any significant new features. Thanks. Dmitry. Derick Rethans wrote: On Wed, 2 Jul 2008, Lukas Kahwe Smith wrote: On 02.07.2008, at 13:41, Christian Seiler wrote: So as things look atm, closures will have to wait until then.

Re: [PHP-DEV] PHP 6 (and forget 5.4) (Was: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch)

2008-07-03 Thread Lukas Kahwe Smith
On 03.07.2008, at 10:34, Dmitry Stogov wrote: Absolutely agree. I don't see any reason for 5.4. We don't plan any significant new features. You guys are scaring me .. I was hoping to evade such discussions. PHP 5.3 is probably the minor version release with the most major changes ever.

Re: [PHP-DEV] PHP 6 (and forget 5.4) (Was: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch)

2008-07-03 Thread Gwynne Raskind
On Jul 3, 2008, at 4:41 AM, Lukas Kahwe Smith wrote: Absolutely agree. I don't see any reason for 5.4. We don't plan any significant new features. You guys are scaring me .. I was hoping to evade such discussions. PHP 5.3 is probably the minor version release with the most major changes

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-03 Thread Christian Seiler
Hi, 1) The RFC page says that closures pass by value by default. Although it is not stated, am I correct in saying that due to the way resources and objects (and presumably therefore lambdas) are handled they will still have the effect of passing by reference anyway, just as with a function

RE: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-03 Thread Andi Gutmans
Kahwe Smith Cc: Christian Seiler; php-dev List Subject: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch Hi Lukas, From my point of view the proposed closures concept is very consistent and implementation doesn't complicate the engine at all. The code without closures will work

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-03 Thread Dmitry Stogov
Subject: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch Hi Lukas, From my point of view the proposed closures concept is very consistent and implementation doesn't complicate the engine at all. The code without closures will work without any changes, but code with closures (instead

Re: [PHP-DEV] PHP 6 (and forget 5.4) (Was: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch)

2008-07-03 Thread Ilia Alshanetsky
Given the 5.3 is not yet out (even as a Beta) I think discussing 5.4 is way way premature. For now I think 5.3 is close enough to 6 in feature set to not warrant 5.4. I think the effort at this point should be spent on getting 5.3 out and figuring out how to proceed with PHP 6. On

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-03 Thread Rasmus Lerdorf
-Original Message- From: Dmitry Stogov [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 12:27 AM To: Lukas Kahwe Smith Cc: Christian Seiler; php-dev List Subject: Re: [PHP-DEV] [RFC] Closures: updated proposal and patch Hi Lukas, From my point of view the proposed closures concept

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-03 Thread Larry Garfield
On Thu, 03 Jul 2008 11:06:48 +0200, Christian Seiler [EMAIL PROTECTED] wrote: Hi, 1) The RFC page says that closures pass by value by default. Although it is not stated, am I correct in saying that due to the way resources and objects (and presumably therefore lambdas) are handled they

[PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-02 Thread Christian Seiler
Hi, After some discussion with Dmitry, he and I have continued to improve the current closure patch. You can find the current proposal with patches for 5_3 and HEAD here: http://wiki.php.net/rfc/closures (Please read it again, I've changed quite a lot.) Basically, it's the syntax with use

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-02 Thread Stanislav Malyshev
Hi! Re-reading the proposal, I encountered something unexpected: $replacer = $example-getReplacer ('goodbye'); echo $replacer ('hello world'); // goodbye world $replacer-setSearch ('world'); echo $replacer ('hello world'); // hello goodbye Does it mean closure would forward all method calls to

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-02 Thread Christian Seiler
Hi Stanislav, Or did you just mean $example-setSearch() and I'm worried about nothing? :) Yes, absolutely, Sorry for the confusion caused. ;-) I fixed that in the Wiki. In this case, I'd just propose to have getThis() anyway. I don't see a need, but I'm not against it. Should be

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-02 Thread Lukas Kahwe Smith
On 02.07.2008, at 13:41, Christian Seiler wrote: I've spoken to Dmitry and he said the patch will be committed to HEAD soon. Since both Dmitry and I still want to have it in 5_3 too, we'd want to ask for opinions on this again - especially since after quite a lot of thorough review and

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-02 Thread Larry Garfield
On Wednesday 02 July 2008 6:41:20 am Christian Seiler wrote: Hi, After some discussion with Dmitry, he and I have continued to improve the current closure patch. You can find the current proposal with patches for 5_3 and HEAD here: http://wiki.php.net/rfc/closures (Please read it again,