RE: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
by Andi Gutmans other posts by this author
Jun 26 2008 5:51PM messages near this date
Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
|
Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
Hey Christian,
Nice job!
More below:
> -----Original Message-----
> From: Christian Seiler [mailto:chris_se@[...].net]
> Sent: Thursday, June 26, 2008 9:24 AM
> To: Dmitry Stogov
> Cc: php-dev List; Andi Gutmans; Stas Malyshev
> Subject: Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP
>
-snip-
>
> * Lexical vars are now copied instead of referenced by default. Using
> & in front of the var, the behaviour may be changed. I added that in
> order to demonstrate that both was possible and that a simply change
> of grammar suffices. In my eyes this is the main issue where a
> discussion has to take place (i.e. copy or reference by default?
> possibility to change default via syntax? which lexical syntax?)
> before the proposal can be accepted.
I think doing this mixed approach is the right one, i.e. $var1, &$var2. It delivers choice a
nd adds clarity as it's explicit about value vs. reference.
> * I provided patches for both lexical $var and use ($var) syntaxes.
I lean towards the use(...) syntax.
> * I provided a patch variant that only stores $this if $this is
> explicitely used inside a closure (or a nested closure of that
> closure). This works since it is possible to detect whether $this
> is used at compile time. For this, I have added a this_used flag
> to the op_array structure.
Safest not to take shortcuts. You get yourself into trouble with things which will stop work
ing. -1 on this optimization.
> * I added tests (Zend/tests/closures_*.phpt) that ensure the correct
> behaviour of closures.
Excellent.
> Anyway, feel free to discuss.
>
> In my eyes, the following questions should be answered:
>
> * Do you want closures in PHP?
I think most people here feel it's useful or are at least indifferent.
> * Do you want closures in PHP 5.3?
I really think we need to get the release process for 5.3 going so I suggest to do it for th
e following minor version and commit it to PHP 6.
Andi
Thread:
Christian Seiler
Wez Furlong
Dmitry Stogov
Stanislav Malyshev
Alexander Wagner
Dmitry Stogov
Andi Gutmans
Christian Seiler
Lukas Kahwe Smith
Sebastian Bergmann
Marcus Boerger
Markus Fischer
Troels Knak-Nielsen
Christian Seiler
Dmitry Stogov
Larry Garfield
Christian Seiler
Dmitry Stogov
Christian Seiler
Lars Strojny
Stanislav Malyshev
Marcus Boerger
Lars Strojny
Troels Knak-Nielsen
Larry Garfield
Marcus Boerger
Dmitry Stogov
Andi Gutmans
Alexander Wagner
Andi Gutmans
Alexander Wagner
Alexander Wagner
Christian Seiler
Alexander Wagner
Lars Strojny
Dmitry Stogov
Marcus Boerger
Lars Strojny
Dmitry Stogov
Alexey Zakhlestin
Federico Lebron
Dmitry Stogov
Rodrigo Saboya
lenar
Larry Garfield
Stanislav Malyshev
Marcus Boerger
Alexander Wagner
Lars Strojny
Larry Garfield
Robert Cummings
Rodrigo Saboya
Alexander Wagner
Christian Seiler
Chris Stockton
Alexander Wagner
Troels Knak-Nielsen
Andi Gutmans
Marcus Boerger
Christian Seiler
Lukas Kahwe Smith
Gwynne Raskind
Andi Gutmans
Christian Seiler
Stanislav Malyshev
Kalle Sommer Nielsen
Troels Knak-Nielsen
Lars Strojny
Alexander Wagner
Stanislav Malyshev
Alexander Wagner
Andi Gutmans
Marcus Boerger
Kalle Sommer Nielsen
Troels Knak-Nielsen
Stanislav Malyshev
Alexey Zakhlestin
Chris Stockton
Alexey Zakhlestin
Gwynne Raskind
Stanislav Malyshev
Christian Seiler
Gwynne Raskind
Stanislav Malyshev
Richard Quadling
Christopher Jones
Marcus Boerger
Steph Fox
Christian Seiler
Marcus Boerger
Stanislav Malyshev
Lars Strojny
Christian Seiler
Stanislav Malyshev
Marcus Boerger
Marcus Boerger
Andrei Zmievski
Stanislav Malyshev
Stanislav Malyshev
Alexey Zakhlestin
Chris Stockton
Christian Seiler
Christian Seiler
Larry Garfield
Edward Z. Yang
Christian Seiler
Larry Garfield
Christian Seiler
Nathan Nobbe
Christian Seiler
Alexey Zakhlestin
Larry Garfield
Philip Olson
|