Re: [PHP-DEV] [Windows] Error Building PHP 5.4 NTS Debug Version, mysqlnd

2012-01-23 Thread Christian Seiler
Hi Pierre, Can reproduce it now, can you open a bug please and assign it to mysql? Done: https://bugs.php.net/bug.php?id=60863 Thanks, Christian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [Windows] Error Building PHP 5.4 NTS Debug Version, mysqlnd

2012-01-22 Thread Christian Seiler
Hi Pierre, I cannot reproduce the error, mysqlnd builds just fine here. What's your configure line? cscript /nologo configure.js --disable-phar --disable-ipv6 --disable-zts --enable-cgi --disable-bcmath --disable-calendar --disable-odbc --disable-tokenizer

[PHP-DEV] [Windows] Error Building PHP 5.4 NTS Debug Version, mysqlnd

2012-01-21 Thread Christian Seiler
Hi, I was compiling PHP 5.4 SVN for Windows and noticed that the NTS Debug version does not compile correctly if mysqlnd is enabled. The ZTS Debug, ZTS Release and NTS Release versions work without any problems. Also, PHP 5.3 in all 4 variants (Debug/Release, NTS/ZTS) has no problems. I've

Re: [PHP-DEV] Closures and $this: Please vote!

2010-02-19 Thread Christian Seiler
Hi, My suggestion is to wait until the 15th of January (that's one month since I started this thread) and that should have been enough time of everybody. So, it's 18th - are we moving forward with this? Yes, Sorry, I've been extremely busy for the last two months, I'll get back to this in

[PHP-DEV] Execution point of session save handler on shutdown

2010-02-19 Thread Christian Seiler
Hello, [CC to pecl-dev since this is APC-related.] I have been investigating a problem occuring when using APC in combination with userspace session save handlers. This has been reported multiple times both in the APC and PHP bugtrackers, bugs related to this issue include (but are most likely

Re: [PHP-DEV] Execution point of session save handler on shutdown

2010-02-19 Thread Christian Seiler
Hi, I've used APC + custom session handler for ages without any problems. Probably just under different circumstances. And couldn't this be fixed without such nasty hooks..? I'm open for other suggestions... Regards, Christian -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] Execution point of session save handler on shutdown

2010-02-19 Thread Christian Seiler
Hi, I have been investigating a problem occuring when using APC in combination with userspace session save handlers. This has been reported multiple times both in the APC and PHP bugtrackers, bugs related to this issue include (but are most likely not limited to): This has been documented

Re: [PHP-DEV] php for android

2010-01-10 Thread Christian Seiler
Hi, If you remove that, there are only two parts that seem to be really ARM-specific: 2) a patch for zend_float.h Both of them are not clear to me, would you care to explain why are they needed? Since I'm responsible for zend_float.h: When running ./configure directly without telling it

Re: [PHP-DEV] Closures and $this: Please vote!

2009-12-24 Thread Christian Seiler
Hello again, A quick summary of the votes so far (since 15th December): internals@ votes: 0: (1) Alexey Zakhlestin A: (1) Hannes Magnusson C: (0) - D: (0) - A+: (2) Christian Seiler, Joey Smith AS: (1) Stanislav Malyshev --- 5 votes [AS is Stas' version

Re: [PHP-DEV] Closures and $this

2009-12-15 Thread Christian Seiler
Hello again, Discuss away! I'm a little disappointed by the non-outcome of this debate. Very few people have responded and most of them seem to agree proposal (A) should be implemented, perhaps with the additional bind/bindTo as in my proposal and perhaps not. The problem here is: (A) was

[PHP-DEV] Closures and $this: Please vote!

2009-12-15 Thread Christian Seiler
Hi Lukas, Call for a vote. This time around people cannot claim to not have had time to review the issue. Also back then we tried to play it safe because of the short time before we were to release. This time there is more time for this to mature if needed inside svn. Ok, so then I call for

Re: [PHP-DEV] Closures and $this: Please vote!

2009-12-15 Thread Christian Seiler
Hi, Ok, so then I call for a vote. Again, here are the options: A+, no direct method calling (get/call problem would be messy) I don't quite follow: Why A+ if no direct method calling? What would be the point of allowing bindTo() if $obj-closureProp() doesn't work anyway? If you don't want

[PHP-DEV] Closures and $this

2009-11-16 Thread Christian Seiler
Hi, since a few months have passed since the last discussion on this topic and perhaps people had time to gather some experience with the current closure implementation in PHP 5.3 I'd like to restart the debate on $this in closures and object extension. Foreword: The discussion should center on

Re: [PHP-DEV] 5.3.0 stable release

2009-06-22 Thread Christian Seiler
Hi Lukas, If issues are found/fixed please send the patches to internals for review. Based on the importance and risk of the patch will then be applied, however the next 2 days should really be focused on testing to make sure we do not have critical issues, minor issues can always be fixed

Re: [PHP-DEV] bug 48541 - critical for PHP 5.3

2009-06-13 Thread Christian Seiler
Hi Greg, I can do it if someone can answer this question: how do closures uniquely identify themselves? spl_autoload_register is mistakenly treating all closures as if they were a single copy of the static method Closure::__invoke, and so only the first registered closure is ever called

Re: [PHP-DEV] bug 48541 - critical for PHP 5.3

2009-06-13 Thread Christian Seiler
Hi Greg, (I meant commit when I said patch, sorry :) http://news.php.net/php.cvs/58696 and http://news.php.net/php.cvs/58697 Thanks, looks fine to me. However, I noticed that closures don't work with spl_autoload_unregister() and spl_autoload_functions(). Also, classes that define __invoke

Re: [PHP-DEV] float ops and _controlfp_s

2009-06-13 Thread Christian Seiler
Hi Pierre, (Btw. you got the wrong Christian as CC. ;-)) There is still a significant performance impact due to _controlfp_s usage. Huh? After the modification I made this should only called once (!) at PHP startup Or did we miss something? Anyway, calling it once should not cause any

Re: [PHP-DEV] bug 48541 - critical for PHP 5.3

2009-06-13 Thread Christian Seiler
Hi, [quote from off-list:] I am in way over my head and would not do a good job fixing these (or have the time), care to take a crack at it? Ok, I'll do that tomorrow morning. I wonder if the problem is that spl_autoload_register should not just be checking to see if zcallable is

Re: [PHP-DEV] Reflection

2009-05-11 Thread Christian seiler
Hi Kalle, 3) Closures, theres alot of closure differences in HEAD and 5.3, for example HEAD has ReflectionMethod::getClosure() and ReflectionFunction::getClosureThis(), but 5.3 does not, which makes it looks like a change in 5.3 that never occured to HEAD, unless that is the logic is

Re: [PHP-DEV] [PATCH] double to long conversion change

2009-04-07 Thread Christian Seiler
Hi Daniel, But, for what you're testing, that's the behavior I'd expect -- once you've reached the precision of a double, you'll only get the closest representation possible (and of course a 64-bit long is more precise than a double since there's no floating point to represent). Also, I

Re: [PHP-DEV] Memory Leak in ob_get_clean() / ob_get_flush ()

2009-03-25 Thread Christian Seiler
Hi Lukas, Did this get addressed yet? No, it didn't. But since no one complained about it I'll commit it later this evening. (commit freeze is over, right?) Regards, Christian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Memory Leak in ob_get_clean() / ob_get_flush ()

2009-03-17 Thread Christian Seiler
Hi, When running 'make test' on my system I discovered that tests/output/ob_start_basic_unerasable_003.phpt and tests/output/ob_start_basic_unerasable_004.phpt produced memory leaks - due to the fact that they first fetch the buffer into return_value but then do RETURN_FALSE if they detect an

Re: [PHP-DEV] Questions on closures and visibility

2009-03-11 Thread Christian Seiler
Hi Nate, Any thoughts or feedback would be very much appreciated. :-) The scoping problem is very deeply related to the $this issue: Should one be able to switch the change of a closure by re-binding it to another object or not? It was also an open point in my RFC on object extension in

Re: [PHP-DEV] ZEND_USER_OPCODE_CONTINUE

2009-02-17 Thread Christian Seiler
Hi Johannes, while implementing a small toy extension (see [1]) I found out that ZEND_USER_OPCODE_CONTINUE seems to misbehave as it doesn't go to the next opcode so I ended up in an endless loop executing the same opcode again and again. Isn't that expected behaviour? If a normal opcode

Re: [PHP-DEV] RFC for new INI's

2009-02-11 Thread Christian Seiler
Hi, variables_order: They should be the same on dev and prod. request_order: Seems like it should be the same. Caution! I've read several times in this thread that request_order should be set to something that also contains C. This is DANGEROUS. request_order was specifically introduced to

[PHP-DEV] Closures: $this support removed for 5.3 beta 1 (but NOT in HEAD!)

2009-01-26 Thread Christian Seiler
Hi, as Lukas and Johannes have requested, I have removed $this support from Closures in PHP 5.3. Technical details on the changes can be found here: http://wiki.php.net/rfc/closures/removal-of-this (I didn't have time to write new tests for everything, I just removed those tests which didn't

Re: [PHP-DEV] Re: [RFC] Object extension, $this binding of closures, chat results

2009-01-22 Thread Christian Seiler
Hi Dmitry, The only difference is in binding/creation. You suggest $obj-method2 = Closure::bind ($obj, function () { ... }); and I would prefer something like create_prototype_method($obj, method2, function () { ... }); I prefer a static method of the Closure class because it does not

Re: [PHP-DEV] [RFC] Object extension, $this binding of closures, chat results

2009-01-22 Thread Christian Seiler
Hi again, ok, I just verified that the current PHP 5.3 CVS has the same behaviour as PHP 5.3 alpha 3 (which is the original design). So basically, I'd suggest the following: * Feature freeze as Lukas and Johannes had planned tomorrow with *no* more changes wrt. closures for beta1, then

Re: [PHP-DEV] [RFC] prototyping

2009-01-20 Thread Christian Seiler
Hi, maybe an IRC meeting is the easiest way to come to an agreement. How about tomorrow evening 21:00 CEST in #php.closures on freenode? Just for clarification: I assume you mean Wednesday, January 21st, 19:00 UTC (CEST == UTC+2) and thus 20:00 CET? Would be fine with me. Regards, Christian

Re: [PHP-DEV] [RFC] prototyping

2009-01-19 Thread Christian seiler
Hi Marcus, And I could say that what the two of you designed ofr PHP is not a design but a very confusing incoherent implementation that is based on the lack of being able to get support for something else in the underlying c implementation. Huh? The current implementation is by

Re: [PHP-DEV] [RFC] prototyping

2009-01-18 Thread Christian Seiler
Hi Marcus, Convoluted? Mess? Are you kidding me? It's standard usage of access handlers. It is a mess right now. You assign a closure to another method and get access to the original owners private members. That is not only unexpected and contradicting anything that any oyther language

Re: [PHP-DEV] [RFC] build IDs proposal

2009-01-15 Thread Christian Seiler
Hi Pierre, Would any of the PHP Windows guys like to comment on this? I did, and the reason behind this proposal was about solving the VC* problem for the end users (we have to add another condition to check, which CRT is used) :) I'm sorry for asking again, maybe I'm just plain stupid ;-)

Re: [PHP-DEV] [RFC] build IDs proposal

2009-01-15 Thread Christian Seiler
Hi, I think that it would be better if we adopted more clean and scalable solution for that. I propose having one string build ID, which would look something like: API20071006,NTS,Debug,VC8 and would be rquired to match exactly in the engine and the module. This should be relatively easy to

Re: [PHP-DEV] [RFC] build IDs proposal

2009-01-15 Thread Christian Seiler
Hi Pierre, A VC6 extension is not compatible with a VC9 build (or the other way round). It crashes randomly depending on what the extension does (xdebug for one is really good for this test :). You wouldn't know about how VC8 fits in here? Anyway, thanks for the pointer to xdebug, I'll try

Re: [PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Christian Seiler
Hi, Basic types were added to our JSON decoder to PHP 5.2.1, this allows one to use json_encode / json_decode on any of our scalar types. Omar correctly identified #38680 as not a bug but it appears that Ilia added support for this anyway violating the RFC [1]. Maybe there was a reason for

[PHP-DEV] Re: cvs: php-src /ext/posix/tests posix_getcwd.phpt posix_getgrnam.phpt posix_getpwnam.phpt posix_getrlimit.phpt posix_initgroups.phpt posix_isatty.phpt posix_mknod.phpt

2008-12-03 Thread Christian Seiler
Hi Felipe, --SKIP-- ?php if (!posix_mknod('posix_getcwd')) die('skip posix_getcwd() not found'); ? ?php if (!posix_mknod('posix_isatty')) die('skip posix_isatty() not found'); ? ?php if (!posix_mknod('posix_mknod')) die('skip posix_mknod() not found'); ? Shouldn't those be

Re: [PHP-DEV] apha3

2008-12-02 Thread Christian Seiler
Hi, I have given you ZE karma. Please commit this yourself no later than Tuesday evening! Thanks done. Regards, Christian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: cvs: ZendEngine2(PHP_5_3) / Zend.m4 acinclude.m4 zend_float.h zend_operators.c zend_strtod.c /tests float_prec_001.phpt

2008-12-02 Thread Christian Seiler
Hi, Your macros are not compatible with autoconf 2.13: ***BUG in Autoconf--please report*** AC_LINK_IFELSE Grmpf. Problems like this are why I absolutely loathe autoconf. I'll install 2.13 right away and fix this. Regards, Christian -- PHP Internals - PHP Runtime Development Mailing

Re: [PHP-DEV] Re: cvs: ZendEngine2(PHP_5_3) / Zend.m4 acinclude.m4 zend_float.h zend_operators.c zend_strtod.c /tests float_prec_001.phpt

2008-12-02 Thread Christian Seiler
Hi, Your macros are not compatible with autoconf 2.13: ***BUG in Autoconf--please report*** AC_LINK_IFELSE Grmpf. Problems like this are why I absolutely loathe autoconf. I'll install 2.13 right away and fix this. Done, tested with autoconf 2.13 and 2.61:

Re: [PHP-DEV] apha3

2008-11-28 Thread Christian Seiler
Hi Lukas, First of all, @all: http://wiki.php.net/rfc/rounding - I didn't have time to update it yet but the basically nothing has changed except for implementation details wrt. FPU precision. For FPU precision explanations see (*). Anyways, a few items from the top of my head that I know

[PHP-DEV] Re: cvs: php-src(PHP_5_3) /ext/standard math.c

2008-10-30 Thread Christian Seiler
Hi, Modified files: (Branch: PHP_5_3) /php-src/ext/standard math.c Log: Fixed bug #42294 (Unified solution for round() based on C99 round) [DOC] New implementation of round() to work-around inconsistencies for win32 and 64 bit platforms. This solution

Re: [PHP-DEV] Re: My rounding proposal: Ok for PHP 5.3?

2008-10-30 Thread Christian Seiler
Hi Lukas, Hi Scott, Scott said he could apply the patch for you. And he is sitting right in front of me .. Actually, since I've stirred up the list a bit just now, I'd like to wait until we have consensus on this issue. But thanks for the offer. :-) Regards, Christian -- PHP Internals -

Re: [PHP-DEV] Re: cvs: php-src(PHP_5_3) /ext/standard math.c

2008-10-30 Thread Christian Seiler
Hi Stefan, 1) Define some macros for math-related functions that will ensure the function itself always uses double precision. Add configure checks for these macros. Do you know what the rationale behind the standard compiler behaviour is? Because trying to outsmart the compiler is

Re: [PHP-DEV] Re: cvs: php-src(PHP_5_3) /ext/standard math.c

2008-10-30 Thread Christian Seiler
Hi, [For conclusive proposal, see below.] 1) Internal FPU precision on x86. Do you have any test cases show the error? Sure. Consider the following C code: #include stdio.h int main (int argc, char **argv) { volatile double v = 100.0; printf (%.35f\n%.35f\n, 0.002877, 2877.0 / v);

Re: [PHP-DEV] namespaces - my RFC

2008-10-15 Thread Christian Seiler
Hi, My proposals are here: http://wiki.php.net/rfc/namespaceref Just for the record: I like both of them, the second one would probably be better to accomodate those who want functions in namespaces. Regards, Christian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe,

[PHP-DEV] Could somebody with ZE2 karma please commit this? (was: [RFC] [PATCH] Rounding in PHP)

2008-09-07 Thread Christian Seiler
Hi, @internals: Anyway, since nobody of the core devs seems to be interested in this topic, is there any objection to me committing this patch to HEAD? Since I received no answer, I assumed that nobody would object and tried to commit my patch to HEAD. Problem is that I don't have ZE2 karma

Re: [PHP-DEV] [RFC] [PATCH] Rounding in PHP

2008-09-04 Thread Christian Seiler
Hi, For the record, I was very excited to see your proposal and the work you've done. Thanks! :) I'm not a PHP dev so I can't comment on the patch, maybe there might be a performance concern? The new algorithm is slightly slower in most of the cases and quite a bit slower if strings have

[PHP-DEV] [RFC] [PATCH] Rounding in PHP

2008-08-23 Thread Christian Seiler
Hi, A few weeks ago I wrote quite a long posting to internals@ that tried to clarify the situation on the round() function in PHP. I was asked to write it up as an RFC in the wiki, which I have done: http://wiki.php.net/rfc/rounding In the mean time, I had some time to think about that problem

Re: [PHP-DEV] [PATCH] Closures and reflection improvements

2008-08-11 Thread Christian Seiler
Hi, all submitted now. Thanks everyone for their help and especially Christian for getting this started. Thanks for making my patch work after the modifications in zend_closures.c. I'm sorry I couldn't do it myself but I was kind of busy the last few days and the simple fix created memory

[PHP-DEV] CVS Account Request: cseiler

2008-08-11 Thread Christian Seiler
Maintaining closures, see http://news.php.net/php.internals/39835 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [PATCH] Closures and reflection improvements

2008-08-11 Thread Christian Seiler
Hi Marcus, Account approved and access granted. Thanks! Please provide the function copying in a function next to _free_function() I just committed that (and included some tests). I hope I didn't do anything wrong in the process, if so, feel free to do so. and care for parameter info as

Re: [PHP-DEV] [PATCH] Closures and reflection improvements

2008-08-04 Thread Christian Seiler
Hi Dmitry, Hi Marcus, I have no objections against ZE part of the patch. If you like ext/reflection part please commit the whole patch. Due to your cleanup wrt. handlers the reflection part will currently (probably) segfault. I'll post an updated patch for this tomorrow. Regards, Christian

Re: [PHP-DEV] [PATCH] Closures and reflection improvements

2008-07-25 Thread Christian Seiler
Hi, http://www.christian-seiler.de/temp/php/2008-07-24-reflection/reflection-closure-fixes-5.3.patch http://www.christian-seiler.de/temp/php/2008-07-24-reflection/reflection-closure-fixes-6.patch The last CVS commit for apply_func_t and TSRMLS_CC conflicted with the patches, I merged the

Re: [PHP-DEV] [PATCH] Closures and reflection improvements

2008-07-25 Thread Christian Seiler
Hi Marcus, patch looks fine and should go in. Thanks. do you think ReflectionMethod::__construct implementation could be done using parameterparsing 'f' rather than the spcial case 'o'? The Problem with 'f' is that it will accept every callback, even normal functions, so that would

Re: [PHP-DEV] question about backward-compatibility break/bug in php 5.2.6

2008-07-24 Thread Christian Seiler
Hi, Last week I submitted a bug report on the issue described below. The response (also below) was that this is not a bug. I fail to see how it could *not* be a bug given that strtotime is parsing an invalid date into a seemingly-arbitrary and definitely-meaningless number, strtotime() has

Re: [PHP-DEV] closures questions

2008-07-24 Thread Christian Seiler
Hi! so do we even want the toString() method? IMHO we should drop toString from Closure. There is one case which *may* cause problems: function doSomething ($callback) { if (!is_callable ($callback)) { throw new Exception (...); } // special treatment if ($callback ==

Re: [PHP-DEV] Php 5.3 Snap - Lambda functions and $this scope

2008-07-24 Thread Christian Seiler
Hi, Wouldn't it be better (and maybe safer) to allow the use of $this as a closure instead of passing it to the new lambda function? We had that in a previous patch. We had quite a few discussions on what the best syntax would be, actually. In the end, Dmitry and I chose to implement it in

[PHP-DEV] [PATCH] Closures and reflection improvements

2008-07-24 Thread Christian Seiler
Hi, I'd like to add the following patch to reflection before the feature freeze, because it does not change any current reflection behaviour but adds quite a bit of good stuff for closures. With the current closure implementation, __invoke always has the same signature as the original lambda

Re: [PHP-DEV] question about backward-compatibility break/bug in php 5.2.6

2008-07-24 Thread Christian Seiler
Hi! This 64-bit machine is running 5.2.5 and returns false on the all-zero datetime string. It was upgraded last week to 5.2.6 and started returning the large negative integer. Ah, yes, the change responsible is the following:

Re: [PHP-DEV] closures questions

2008-07-22 Thread Christian Seiler
Hi Lukas, 1) Closures on class properties just don't work, the only way to do it is to do something like: $c = $a-b; $c(); Calling: $a-b(); will result in method A::B() does not exists. Yes, that's expected behaviour (we had a few comments on this on the list). Compare this to, for example:

Re: [PHP-DEV] Re: Rounding in PHP and floating point numbers in general

2008-07-22 Thread Christian Seiler
Hi! Note too that the value actually stored in $f differs from that we may expect simply reading the source: the difference is very small, but it exists. Float values can always be converted back in decimal base with exact precision, so for example in our case the $f variable now contains

[PHP-DEV] Rounding in PHP and floating point numbers in general

2008-07-21 Thread Christian Seiler
Hi, With this posting I'd like to make another try in resolving the rounding issues in PHP. This is basically in response to http://bugs.php.net/bug.php?id=42294 (bug #42294) where I added a comment last year. Since then I have read quite a bit on this subject so I feel that I should post an

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-03 Thread Christian Seiler
Hi, 1) The RFC page says that closures pass by value by default. Although it is not stated, am I correct in saying that due to the way resources and objects (and presumably therefore lambdas) are handled they will still have the effect of passing by reference anyway, just as with a function

[PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-02 Thread Christian Seiler
Hi, After some discussion with Dmitry, he and I have continued to improve the current closure patch. You can find the current proposal with patches for 5_3 and HEAD here: http://wiki.php.net/rfc/closures (Please read it again, I've changed quite a lot.) Basically, it's the syntax with use

Re: [PHP-DEV] [RFC] Closures: updated proposal and patch

2008-07-02 Thread Christian Seiler
Hi Stanislav, Or did you just mean $example-setSearch() and I'm worried about nothing? :) Yes, absolutely, Sorry for the confusion caused. ;-) I fixed that in the Wiki. In this case, I'd just propose to have getThis() anyway. I don't see a need, but I'm not against it. Should be

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

2008-06-26 Thread Christian Seiler
Hi Dmitry, I'm fine if you'll improve my patch (It's mainly yours :) I updated my closures RFC: http://wiki.php.net/rfc/closures I have based my new version of the patch on yours (Dmitry), but I made some changes to that: * Objects instead of resources are used, two new files

Re: [PHP-DEV] Using Network functions.

2008-06-26 Thread Christian Seiler
Hi! 2. What does streams has to do with this networking? Can it be done using streams? Yes, it can. Take the following simple, incomplete example without much error handling as a starting point: // in the header #include php_streams.h // PHP function: PHP_FUNCTION(simplehttp_fetch) {

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

2008-06-26 Thread Christian Seiler
Hi Marcus, I like the new ability to reference if wanted. But then I don't like references at all. As I said: Without reference support, you can't call it closures. Closures must per definition have the possibility to change the values of used variables in the parent scope - and the only

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

2008-06-26 Thread Christian Seiler
Hi! I see exactly one problem with the patch, which is that the above script shouldn't work without use ($i). I find it counterintuitive that the creation of the lambda creates a copy of $i, but all invocations of $lambda use a reference to the same $i. For n calls to $lambda, there are only 2

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

2008-06-20 Thread Christian Seiler
Hi! Since some raised issues with the word lexical, what do people think to just re-use the (afaik deprecated) var keyword, so we won't need a new keyword in the chain. That would be quite confusing IMHO, since JavaScript uses 'var' for the exact opposite - to declare variables that are

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

2008-06-19 Thread Christian Seiler
Hi Dmitry, First of all: Your patch does really simplify things internally quite a bit - I like it. I have a few issues though: The patch shouldn't affect opcode caches and other extensions as it doesn't change any structures. I don't see a problem in changing structures for either

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

2008-06-18 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 only

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

2008-06-18 Thread Christian Seiler
Hi! 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? First of all: global and static are also used to create references to

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

2008-06-18 Thread Christian Seiler
Hi, [I'm going to collect here a bit:] Stanislav Malyshev wrote: lexical in the proposal binds to creator's scope, not caller's scope, as I understood. Anyway, binding to caller's immediate scope doesn't seem that useful since you could just pass it as a parameter when calling. Correct and

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

2008-06-18 Thread Christian Seiler
Hi Andi, Hi Stanislav, - You mention global and static as examples of how we do things today. They are actually not good examples because the binding by reference which they do has been a real pain over the years. This is why we introduced the $GLOBALS[] array so that you could also assign by

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 only

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 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)

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

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

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

2008-06-16 Thread Christian Seiler
Hi, 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. INTRODUCTION Closures and lambda functions can make programming much easier in several ways: 1. Lambda functions allow the quick

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

2008-06-16 Thread Christian Seiler
Hi, Lukas Kahwe Smith asked me to put my proposal into the PHP wiki, which I have done: http://wiki.php.net/rfc/closures I also have incorporated the last comment by troels knak-nielsen about JS behaving the same way as my patch and thus not being that much of a WTF at all (I somehow had a

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-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-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

[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

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

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 environments