Re: PATCH: Implementing closures in PHP (was: anonymous functions in PHP)

From: Date: Sat, 22 Dec 2007 18:47:40 +0000
Subject: Re: PATCH: Implementing closures in PHP (was: anonymous functions in PHP)
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-34220@lists.php.net to get a copy of this message
I have another observation about names. Instead of using an arbitrary name, as the name of the function, wouldn't it be possible to let the name be derived from the function-body. Eg., if you took the function-body's tokens and created a hash from them. This would have two implications: 1) Multiple definitions of the same function would be optimised into one. And more importantly 2) , it would be possible to serialize/unserialize a closure. Of course, this won't work if an anonymous function is a resource, since resources can't be serialized. This would work for Wez' original patch though. -- troels

« previous php.internals (#34220) next »