Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Alexey Zakhlestin
On 6/18/08, Andi Gutmans <[EMAIL PROTECTED]> wrote: > 1) I am not sure that the current semantics of the "lexical" keyword is > great in all cases. Is the reason why you don't allow by-value binding so > that we don't have to manage more than one lambda instance per declaration? by-reference bi

RE: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Andi Gutmans
Hi Christian, This is a very nice piece of work. Definitely addresses a lot of the issues we have raised in the past. I would like to see such a solution make its way into PHP (see below re: timing). There are some things I'd like to consider: 1) I am not sure that the current semantics

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Larry Garfield
On Tuesday 17 June 2008, Christian Seiler wrote: > Hi, > > > - I am a little confused about the OOP interaction. How does a function > > become a public method of the class? > > To clarify: the "public method" ist just the internal representation of > the lambda function and has *nothing* to do wi

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Christopher Jones
Christian Seiler wrote: > As a followup to the discussion in January, I'd like post a revised > patch to this list that implements closures and anonymous functions > in PHP. Did I miss seeing its phpt tests? A really thorough test suite might the case for inclusion in PHP 5.3. Chris -- Christo

Re: [PHP-DEV] Algorithm Optimizations - string search

2008-06-17 Thread Nuno Lopes
Hi, Sorry for taking so long to answer, but I'm trying to catch up last stuff. It's known that usually to optimize things for longer inputs you usually end up making things for short inputs worst. So IMHO, I think you should have the len==1 optimization and then use the KMP algorithm. Your impl

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Christian Seiler
Hi! I'm not Johannes and I didn't review the proposal in detail yet, but I think we have enough for 5.3 right now. I'd think we better concentrate on tying the loose ends and rolling beta out and then moving towards the release than adding more and more features and never releasing it. 5.3 is

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Stanislav Malyshev
Hi! nicely put but not in agreement with the PHP world. First we cannot add a new feature like this in a mini release as it comes with an API change. And second PHP is not anywhere close so we'd have to do it in a PHP 5.4 and personally I would like to avoid it. You meant "PHP 6 not anywhere

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Lars Strojny
Hi Markus, hi Stas, Am Dienstag, den 17.06.2008, 12:19 -0700 schrieb Stanislav Malyshev: [...] > I'm not Johannes and I didn't review the proposal in detail yet, but I > think we have enough for 5.3 right now. I'd think we better concentrate > on tying the loose ends and rolling beta out and the

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Marcus Boerger
Hello Stanislav, nicely put but not in agreement with the PHP world. First we cannot add a new feature like this in a mini release as it comes with an API change. And second PHP is not anywhere close so we'd have to do it in a PHP 5.4 and personally I would like to avoid it. marcus Tuesday, Ju

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Alexey Zakhlestin
On 6/17/08, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > I'm not Johannes and I didn't review the proposal in detail yet, but I > think we have enough for 5.3 right now. I'd think we better concentrate on > tying the loose ends and rolling beta out and then moving towards the > release than ad

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Steph Fox
I'm not Johannes and I didn't review the proposal in detail yet, but I think we have enough for 5.3 right now. I'd think we better concentrate on tying the loose ends and rolling beta out and then moving towards the release than adding more and more features and never releasing it. 5.3 is not

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Stanislav Malyshev
Hi! Johannes, what's your take on this one for 5.3? I'm not Johannes and I didn't review the proposal in detail yet, but I think we have enough for 5.3 right now. I'd think we better concentrate on tying the loose ends and rolling beta out and then moving towards the release than adding mor

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Marcus Boerger
Hello Christian, Johannes, Tuesday, June 17, 2008, 2:24:01 PM, you wrote: > Hi Marcus, > I now have revised my patch to include your suggestions: > http://www.christian-seiler.de/temp/closures-php-5.3-2008-06-17-2.diff > The changes to the previous version: > - \0 at the start of the compil

Re: [PHP-DEV] extensions status, to move to pecl or to drop

2008-06-17 Thread Nuno Lopes
>> What would rock is to have it supported by gcov (by us or >> somewhere else with a public report), would it be possible? > > How can I get this done? I'm adding Nuno to the loop, he is the one leading the gcov initiative and will surely explain the setup in a better way than me :) I can add

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Chris Stockton
On Tue, Jun 17, 2008 at 2:21 AM, Steph Fox <[EMAIL PROTECTED]> wrote: > > Hi, > > Seems like you are missing some PHP programming basics. Strings are not an >> array of chars, please go back to making ping pong in java c# or whatever >> other little comp sci classes you took. PHP is not any of th

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Chris Stockton
Hello, Great patch and a much needed feature. One thing I do not agree with is the point in the lexical key word, seems it should be natural to inherit the outer scope. I guess the choice of adding lexical and going slightly against the grain of typical closure implementations like scheme or ecmas

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Christian Seiler
Hi Marcus, I now have revised my patch to include your suggestions: http://www.christian-seiler.de/temp/closures-php-5.3-2008-06-17-2.diff The changes to the previous version: - \0 at the start of the compiled lambda function name is dropped. - lambdas which are class members are now marked

[PHP-DEV] wiki update

2008-06-17 Thread Lukas Kahwe Smith
Hello, I just updated wiki.php.net to the 2008-05-05 release [1]. No data should have been lost. Aside from minor visual tweaks the main improvement is that we now default to a diff in the RSS feeds. We might see some other tweaks today (or over the course of the day). The main thing we a

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Edward Z. Yang
Larry Garfield wrote: > $e = new Example(); > $lambda = $e->myMethod(); > $e->$lambda(5); > > That doesn't seem right at all, but that's how I interpret "Essentially, > closures inside methods are added as public methods to the class that > contains the original method." Can you give an example

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Edward Z. Yang
Stefan Walk wrote: > You're not learning from the mistakes of other languages (ruby in this case, > which removed Enumerable from String in 1.9) ... "foreach" makes no sense for > strings, because it's unclear what you want (with unicode terminology here, > as this is for php6): > "for each byt

[PHP-DEV] [PATCH] ext/phar/util.c

2008-06-17 Thread xuefeng
d:\devel\php\php5\ext\phar\util.c(1832) : error C2036: 'void *' : unknown size d:\devel\php\php5\ext\phar\util.c(1864) : error C2036: 'void *' : unknown size NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' : return code '0x2' Stop. Index: ext/pha

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Christian Seiler
Hi Marcus, very nice work. Thanks! The only thing I don't like is the function naming (ā€œ\0__compiled_lambda_FILENAME_Nā€). Can we drop the \0? I used \0 because it is already used in two other places: 1) create_function (run-time lambda functions) uses \0__lambda_N 2) build_runtime_defin

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Marcus Boerger
Hello Christian, very nice work. I think we should really add this to 5.3. The only thing I don't like is the function naming (ā€œ\0__compiled_lambda_FILENAME_Nā€). Can we drop the \0? For methods inside classes, do we have to provide real private methods or do we support visibility fully? Or did you

[PHP-DEV] PHP RFC: closures

2008-06-17 Thread Karoly Negyesi
Hi, Let me introduce myself (as much as pertains to this letter): I am one of the lead developers of Drupal core (Drupal, I believe, is quite well known by now), I maintain the form API and the menu system. I do not know much about PHP internals, but I spent most of the awake time in the last four

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Stefan Walk
On Tuesday 17 June 2008 08:27:37 Arvids Godjuks wrote: > 2008/6/16 Edward Z. Yang <[EMAIL PROTECTED]>: > > PHP userland code may not treat strings as first class arrays, but > > that's certainly how they are represented internally. > > > > Anyway, it would be neat if we could get that foreach synta

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Steph Fox
Hi, Seems like you are missing some PHP programming basics. Strings are not an array of chars, please go back to making ping pong in java c# or whatever other little comp sci classes you took. PHP is not any of them. Foreach("foo" as $key => $char) {}, after learning, please be quiet and let a

Re: [PHP-DEV] deprecation status of $str{42} versus $str[42]

2008-06-17 Thread Richard Quadling
2008/6/16 Chris Stockton <[EMAIL PROTECTED]>: > Hello, > > On Sun, Jun 15, 2008 at 11:20 PM, Arvids Godjuks <[EMAIL PROTECTED] > > > wrote: > > > String is an array of chars, always was and is such in any programming > > language. So I see argument for {} as missing knowledge for some > programmin

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Christian Seiler
Hi! class Dynamic { private $someVar = 5; /// adding a function to instances from within the class public function addMethodAtRuntime() { $this->dynamicFunc1 = function() { return $this->someVar; // expected to work } } } /// invoking dynamically added methods ///

Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP

2008-06-17 Thread Christian Seiler
Hi, - I am a little confused about the OOP interaction. How does a function become a public method of the class? To clarify: the "public method" ist just the internal representation of the lambda function and has *nothing* to do with the semantics of calling the lambda itself. The "method" on