Re: PATCH: Implementing closures in PHP
| From: | troels knak-nielsen | Date: | Sun, 23 Dec 2007 02:24:22 +0000 |
| Subject: | Re: PATCH: Implementing closures in PHP | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34228@lists.php.net to get a copy of this message | ||
On Dec 23, 2007 2:23 AM, Christian Seiler <chris_se@gmx.net> wrote:
> First of all: I don't quite understand what you mean when you want to
> serialize a function (closure or not)? The opcodes? Ok, sure, with the
> current PHP implementation you can serialize the variable used to CALL
> the function (e.g. with $func = 'str_replace'; $func is only a string
Admittedly, I got the idea, in relation to Wez' patch. There, it would
be trivial to serialize/unserialize the function pointer. I suppose
that isn't immediately possible, if the closure is a resource type.
> and can be serialized). But where would you need that? (Ok, for normal
> functions that are named this could actually be useful, but for
> anonymous functions?)
If a closure could be serialized, it would allow for continuation
style applications. I'm not sure, how good idea this is in web
applications anyway, so just ignore that.
Just a minor note; The semi-colon after the closing brace, seems
superfluous. Is there any reason for it?
Otherwise excellent work there.
--
troels