Re: [PHP-DEV] PATCH: Implementing closures in PHP (was: anonymous functions in PHP)

2008-03-23 Thread Marcus Boerger
Hello Christian, I have put your proposal as a link to a PHP GSoC 2008 idea here: http://wiki.php.net/gsoc/2008 Feel invited to add to this idea in whatever way you want :-) marcus Saturday, December 22, 2007, 4:08:04 PM, you wrote: > Hi, > I was following this thread and came upon Jeff's p

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-24 Thread Xuefer
any idea about the possibility of hash conflict? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-24 Thread Jon Parise
On Mon, Dec 24, 2007 at 04:14:00PM +0100, Christian Seiler wrote: > > 3. The "is_anonymous" flags could be zend_bool values instead of bare > > integers, although that breaks the precedent started by some > > related flags (such as "is_method"). > > You're right, zend_bool is a better id

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-24 Thread Christian Seiler
Hi! Thanks for reading through! > 1. There appear to be some spurious whitespace insertions in this > version of the patch. Oh, that's probably my editor, I'll fix that. > 2. The terms "lamba" and "anonymous function" are being used > interchangeably. If we're going to introduce new

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-24 Thread Jon Parise
On Sun, Dec 23, 2007 at 02:40:02PM +0100, Christian Seiler wrote: > I now updated the patch so that this problem is addressed. You will find > it here: > > http://www.christian-seiler.de/temp/closures-php-5-3-v2.patch A few minor items from a quick read-through of the patch: 1. There appear to

Re: [PHP-DEV] PATCH: Implementing closures in PHP (was: anonymous functions in PHP)

2007-12-23 Thread Martin Alterisio
2007/12/22, Christian Seiler <[EMAIL PROTECTED]>: > > Hi, > > I was following this thread and came upon Jeff's posting on how closures > could be implemented in PHP. > > Since I would find the feature to be EXTREMELY useful, I decided to > actually implement it more or less the way Jeff proposed. S

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-23 Thread David Zülke
Cool. I hope I'll have the time to give that a shot over the holidays. Great work, nice patch (from what I, with my rubbish knowledge, can tell :D) David Am 23.12.2007 um 14:40 schrieb Christian Seiler: Hi David! One question about the names you generate for the function table in com

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-23 Thread Christian Seiler
Hi David! > One question about the names you generate for the function table in > combination with opcode caches. [...] I now updated the patch so that this problem is addressed. You will find it here: http://www.christian-seiler.de/temp/closures-php-5-3-v2.patch The compiled functions are now

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-23 Thread Christian Seiler
Hi! > Just a minor note; The semi-colon after the closing brace, seems > superfluous. Is there any reason for it? Unfortunately, yes. The problem is that the closure must be an expression so it can a) be assigned to a variable and b) returned directly. And since the expression is only a part of a

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-22 Thread troels knak-nielsen
On Dec 23, 2007 2:23 AM, Christian Seiler <[EMAIL PROTECTED]> 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 functi

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-22 Thread Christian Seiler
Hi! I'm going to answer to everybody at once, if that's OK. David Zülke wrote: > One question about the names you generate for the function table in > combination with opcode caches. > [...] > While this is a constructed example, it could easily occur with > conditional includes with environment

Re: [PHP-DEV] PATCH: Implementing closures in PHP (was: anonymous functions in PHP)

2007-12-22 Thread Martin Alterisio
2007/12/22, Christian Seiler <[EMAIL PROTECTED]>: > > > PPS: Oh, yeah, if it should be legally necessary, I grant the right to > anybody to use this patch under any OSI certified license you may want > to choose. > > That's very kind of you but, if I was explained right, you don't have copyright on

Re: [PHP-DEV] PATCH: Implementing closures in PHP (was: anonymous functions in PHP)

2007-12-22 Thread troels knak-nielsen
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

Re: [PHP-DEV] PATCH: Implementing closures in PHP (was: anonymous functions in PHP)

2007-12-22 Thread David Zülke
One question about the names you generate for the function table in combination with opcode caches. Let's assume I have APC installed, and do the following: foo.php: $foo = function() { echo "foo"; } bar.php: include('foo.php'); All works fine, and cached versions of both files would be c

Re: [PHP-DEV] PATCH: Implementing closures in PHP

2007-12-22 Thread Christian Seiler
Hi! > typo alert: Oh, thanks (don't know how it got in there ;-)), I fixed that, same address: http://www.christian-seiler.de/temp/closures-php-5-3.patch > Very impressive patch, I'll be interested to try it out when I get a chance. Thanks! Christian -- PHP Internals - PHP Runtime Developme

[PHP-DEV] PATCH: Implementing closures in PHP (was: anonymous functions in PHP)

2007-12-22 Thread Christian Seiler
Hi, I was following this thread and came upon Jeff's posting on how closures could be implemented in PHP. Since I would find the feature to be EXTREMELY useful, I decided to actually implement it more or less the way Jeff proposed. So, here's the patch (against PHP_5_3, I can write one against HE