Re: [PHP-DEV] Closures and type hinting

2012-10-13 Thread Christian Kaps
Hi Now if you pass a closure to the scan method which doesn't follow the signature of the __invoke method, the engine should throw an error. What do you think? You are trying to take typing way beyond what PHP (or probably any mainstream dynamic language that exists now) provides. There are

Re: [PHP-DEV] Closures and type hinting

2012-10-13 Thread Christian Kaps
Am 12.10.2012 23:06, schrieb Nikita Popov: On Fri, Oct 12, 2012 at 10:58 AM, Christian Kaps christian.k...@mohiva.com wrote: At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface

[PHP-DEV] Closures and type hinting

2012-10-12 Thread Christian Kaps
At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface Broker { public function scan(Request $request, Closure $onFound); } An implementation of the interface could be as

Re: [PHP-DEV] Closures and type hinting

2012-10-12 Thread Anthony Ferrara
On Oct 12, 2012 10:59 AM, Christian Kaps christian.k...@mohiva.com wrote: At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface Broker { public function scan(Request

Re: [PHP-DEV] Closures and type hinting

2012-10-12 Thread Stas Malyshev
Hi! Now if you pass a closure to the scan method which doesn't follow the signature of the __invoke method, the engine should throw an error. What do you think? You are trying to take typing way beyond what PHP (or probably any mainstream dynamic language that exists now) provides. There

Re: [PHP-DEV] Closures and type hinting

2012-10-12 Thread Nikita Popov
On Fri, Oct 12, 2012 at 10:58 AM, Christian Kaps christian.k...@mohiva.com wrote: At the moment it isn't possible to restrict/define the arguments for a closure which is defined as parameter for a method. Please look at this small example. interface Broker { public function scan(Request

[PHP-DEV] Closures: Object extension

2012-01-06 Thread Marcello Duarte
Hi, What is the status of this RFC: Closures: Object extension? https://wiki.php.net/rfc/closures/object-extension _md

Re: [PHP-DEV] Closures: Object extension

2012-01-06 Thread jpauli
It's been merged in 5.4 branch. http://svn.php.net/viewvc?view=revisionrevision=316300http://svn.php.net/viewvc?view=revisionrevision=316300 is the rev I think. Stas should have more info about that :) Cheers Julien.Pauli On Fri, Jan 6, 2012 at 3:47 PM, Marcello Duarte

Re: [PHP-DEV] Closures as methods (and Closure::bind)

2010-08-12 Thread Gustavo Lopes
On Wed, 11 Aug 2010 14:57:47 +0100, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2010-08-11 at 14:38 +0100, Gustavo Lopes wrote: I've updated the wiki page for Closures with objects extension with things that are in Proposal A with modifications but are not implemented:

[PHP-DEV] Closures as methods (and Closure::bind)

2010-08-11 Thread Gustavo Lopes
I've updated the wiki page for Closures with objects extension with things that are in Proposal A with modifications but are not implemented: http://wiki.php.net/rfc/closures/object-extension#status_as_of_august_10_2010 I propose an implementation of closures stored in properties used as

Re: [PHP-DEV] Closures as methods (and Closure::bind)

2010-08-11 Thread Johannes Schlüter
On Wed, 2010-08-11 at 14:38 +0100, Gustavo Lopes wrote: I've updated the wiki page for Closures with objects extension with things that are in Proposal A with modifications but are not implemented: http://wiki.php.net/rfc/closures/object-extension#status_as_of_august_10_2010 I propose an

Re: [PHP-DEV] Closures as methods (and Closure::bind)

2010-08-11 Thread Gustavo Lopes
On Wed, 11 Aug 2010 14:57:47 +0100, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2010-08-11 at 14:38 +0100, Gustavo Lopes wrote: I've updated the wiki page for Closures with objects extension with things that are in Proposal A with modifications but are not implemented:

Re: [PHP-DEV] Closures as methods (and Closure::bind)

2010-08-11 Thread Johannes Schlüter
On Wed, 2010-08-11 at 15:29 +0100, Gustavo Lopes wrote: * What about allowing properties with function names as strings or array($obj_or_class, 'method'), won't that be needed for being consistent with local variables? Well, you cannot do $a = 'phpinfo'; $a(); as

Re: [PHP-DEV] Closures as methods (and Closure::bind)

2010-08-11 Thread Gustavo Lopes
On Wed, 11 Aug 2010 15:37:01 +0100, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2010-08-11 at 15:29 +0100, Gustavo Lopes wrote: * What about allowing properties with function names as strings or array($obj_or_class, 'method'), won't that be needed for being

Re: [PHP-DEV] Closures as methods (and Closure::bind)

2010-08-11 Thread Gustavo Lopes
On Wed, 11 Aug 2010 15:37:01 +0100, Johannes Schlüter johan...@schlueters.de wrote: On Wed, 2010-08-11 at 15:29 +0100, Gustavo Lopes wrote: * What about allowing properties with function names as strings or array($obj_or_class, 'method'), won't that be needed for being

[PHP-DEV] Closures, rebinding and scopes

2010-08-03 Thread Gustavo Lopes
Hi Even though one cannot bind a static closure to an instance, one can rebind its scope with the Closure::bind/Closure::bindTo: class foo { static protected $field = foo_field; static function getClosure() { return static function () {

Re: [PHP-DEV] closures and $this

2010-07-23 Thread Harald Lapp
Am 23.07.10 06:05, schrieb Adam Harvey: On 23 July 2010 03:05, Harald Lappharald.l...@gmail.com wrote: i would like to ask what's the state of $this (and 'self') in closures. there seems to be no news on this topic for several month now. php 5.3.3 was just released and still nothing has

Re: [PHP-DEV] closures and $this

2010-07-23 Thread Harald Lapp
Am 23.07.10 06:05, schrieb Adam Harvey: On 23 July 2010 03:05, Harald Lappharald.l...@gmail.com wrote: i would like to ask what's the state of $this (and 'self') in closures. there seems to be no news on this topic for several month now. php 5.3.3 was just released and still nothing has

Re: [PHP-DEV] closures and $this

2010-07-23 Thread Lukas Kahwe Smith
On 23.07.2010, at 11:35, Harald Lapp wrote: Am 23.07.10 06:05, schrieb Adam Harvey: On 23 July 2010 03:05, Harald Lappharald.l...@gmail.com wrote: i would like to ask what's the state of $this (and 'self') in closures. there seems to be no news on this topic for several month now. php 5.3.3

[PHP-DEV] closures and $this

2010-07-22 Thread Harald Lapp
hello, i would like to ask what's the state of $this (and 'self') in closures. there seems to be no news on this topic for several month now. php 5.3.3 was just released and still nothing has changed regarding this. so i would like to ask, for which php release a solution is planned. thanks

Re: [PHP-DEV] closures and $this

2010-07-22 Thread Adam Harvey
On 23 July 2010 03:05, Harald Lapp harald.l...@gmail.com wrote: i would like to ask what's the state of $this (and 'self') in closures. there seems to be no news on this topic for several month now. php 5.3.3 was just released and still nothing has changed regarding this. so i would like to

[PHP-DEV] What about static/self was: (Re: [PHP-DEV] Closures and $this)

2010-04-20 Thread mathieu.suen
Hi, Also $this have been wildly discuss here, but the same discussion can be apply to static/self. self might be simple to figure out how to bind within a closure. It can be bind to the name of the class where the closure is define. static is a more tricky one but it should be the same thing

[PHP-DEV] Re: What about static/self was: (Re: [PHP-DEV] Closures and $this)

2010-04-20 Thread Stanislav Malyshev
Hi! Also $this have been wildly discuss here, but the same discussion can be apply to static/self. self might be simple to figure out how to bind within a closure. It can be bind to the name of the class where the closure is define. I would guess self binds to the scope, and static binds to

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

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

2010-01-18 Thread Stanislav Malyshev
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? -- Stanislav Malyshev, Zend Software Architect s...@zend.com http://www.zend.com/

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 with

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

2009-12-17 Thread Victor Bolshov
I vote for (A). bind() and bindTo() seem messy to me. However, I mostly vote for no implicit $this changes in closures (no javascript-like behaviour), so (A+) approach would be much better than (C) or (D). (0) case is not my choice, because I really would like to see $this support in closures

Re: [PHP-DEV] Closures and $this

2009-12-16 Thread Richard Quadling
2009/12/15 Christian Seiler chris...@gmx.net: 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

Re: [PHP-DEV] Closures and $this

2009-12-16 Thread la...@garfieldtech.com
Richard Quadling wrote: How much of a use case is binding $this to closures (personally, I think this is quite a common usage, but I've been using JavaScript so maybe I've got the wrong head on). But, if there are significant technical/internal issues with regard to binding $this to closures,

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

2009-12-16 Thread Joey Smith
On Tue, Dec 15, 2009 at 08:46:44PM +0100, Christian Seiler wrote: (A+): (A) + Closure::bind Closure-bindTo for rebinding if this is wanted the possibility to call a closure as an object method. (See last section of RFC for details) +1 for A+ with class scope option 2 I'm a bit

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

Re: [PHP-DEV] Closures and $this

2009-12-15 Thread Lukas Kahwe Smith
On 15.12.2009, at 20:01, Christian Seiler wrote: 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

[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 Hannes Magnusson
On Tue, Dec 15, 2009 at 20:46, Christian Seiler chris...@gmx.net wrote: (A): Original closures implementation:         $this is always the object context at         closure creation. No possibility to do         $someObject-closureProperty(...) and thus         no possibility to extend

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

2009-12-15 Thread Stanislav Malyshev
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) one additional thing: $a = static function () {} should leave $this not bound (in case for some reason you don't want it to be bound, e.g. to avoid keeping reference

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

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

2009-12-15 Thread Alexey Zakhlestin
On 15.12.2009, at 22:46, Christian Seiler wrote: Ok, so then I call for a vote. Again, here are the options: (0): No $this in closures, keep it that way. (keep PHP 5.3 behavior) I vote for (0) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

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

2009-12-15 Thread Ionut G. Stan
A+, but I'm not an internal dev. On 12/15/2009 21:46, Christian Seiler wrote: 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

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

2009-12-15 Thread Tjerk Anne Meesters
Hi, Maybe I don't exactly understand the need for closureProperty(); also, I haven't read the rfc ;-) My understanding would be that you can treat it as a callable object, like so: $a = function($msg) { echo $this-id, : , $msg, [ calls: , ++$this-calls, ]; } $a-id = 123; $a(hello world); If

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

2009-12-15 Thread Richard Quadling
2009/12/15 Ionut G. Stan ionut.g.s...@gmail.com: A+, but I'm not an internal dev. On 12/15/2009 21:46, Christian Seiler wrote: 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

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

2009-12-15 Thread Mike Robinson
Christian Seiler wrote 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

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

2009-12-15 Thread Larry Garfield
On Tuesday 15 December 2009 1:46:44 pm Christian Seiler wrote: 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

Re: [PHP-DEV] Closures and $this

2009-11-20 Thread Michael Stillwell
On Thu, Nov 19, 2009 at 4:29 PM, Jelrik van Hal jelri...@jelrikvh.nl wrote: Victor, I do wholeheartedly agree with you about the mess things will be when allowing $this to refer to different things in different contexts of calling the same closure (B, C and D): I think it'll prove very

Re: [PHP-DEV] Closures and $this

2009-11-19 Thread Jelrik van Hal
Victor Bolshov wrote: Hi. Personally, I beleive that (A) approach is the best: bind $this to the object scope at creation and never change it, issue error when $this is used where not available. It also seems to me like this way it could be implemented with better performance, am I right?

Re: [PHP-DEV] Closures and $this

2009-11-19 Thread Stanislav Malyshev
Hi! If php-people really would like rebinding $this, I beleive this should be done via method like Closure-bindTo() - to make the fact of rebinding clear in the code. However, there is a problem with rebinding $this - that was not mentioned yet, I think. This can be a problem, but since PHP

Re: [PHP-DEV] Closures and $this

2009-11-19 Thread Victor Bolshov
Hi so you can with $foo-$bar() or $foo() You're talking about variable functions/methods. But that is not the subject of discussion. Variable functions/methods are useful but introduce mess. This is well-known and this feature exists in PHP for a long time - so everybody should be condidered as

Re: [PHP-DEV] Closures and $this

2009-11-18 Thread Richard Quadling
2009/11/16 Christian Seiler chris...@gmx.net: 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

Re: [PHP-DEV] Closures and $this

2009-11-18 Thread Stanislav Malyshev
Hi! As for public/protected/private ... $fn = function() use() bind() access(CLOSURE_PUBLIC | CLOSURE_PROTECTED | CLOSURE_PRIVATE) {}; I have very hard time imagining somebody that would be comfortable using such a construct. What happened to keeping it simple? And why every tiniest

Re: [PHP-DEV] Closures and $this

2009-11-18 Thread Chris Stockton
Hello, On Wed, Nov 18, 2009 at 11:44 AM, Stanislav Malyshev s...@zend.com wrote: I have very hard time imagining somebody that would be comfortable using such a construct. What happened to keeping it simple? And why every tiniest feature of every remotest imaginable use case has to be brought

Re: [PHP-DEV] Closures and $this

2009-11-18 Thread Stanislav Malyshev
Hi! That syntax made my eyes hurt, but I think really the problem is that people want to dynamically add methods with $this in the closure pointing the the object it has been attached too. Really I like A. but We can add method to Closure class to allow that. See Closure::bind and bindTo in

Re: [PHP-DEV] Closures and $this

2009-11-17 Thread Mathieu Suen
Christian Seiler a écrit : 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

Re: [PHP-DEV] Closures and $this

2009-11-17 Thread Chris Stockton
Hello, On Tue, Nov 17, 2009 at 2:59 AM, Mathieu Suen mathieu.s...@easyflirt.com wrote: Christian Seiler a écrit : 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

Re: [PHP-DEV] Closures and $this

2009-11-17 Thread Mathieu Suen
Chris Stockton a écrit : Hello, On Tue, Nov 17, 2009 at 2:59 AM, Mathieu Suen mathieu.s...@easyflirt.com wrote: Christian Seiler a écrit : 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

Re: [PHP-DEV] Closures and $this

2009-11-17 Thread Victor Bolshov
Hi. Personally, I beleive that (A) approach is the best: bind $this to the object scope at creation and never change it, issue error when $this is used where not available. It also seems to me like this way it could be implemented with better performance, am I right? Dynamically changing $this

[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] Closures and __FUNCTION__

2009-04-13 Thread Stanislav Malyshev
Hi! The original anonymous functions patch[1] contained support for __FUNCTION__ as a recursion mechanism in closures, such that I should be able to do something like this: $factorial = function($n) { if ($n == 1) return 1; else return $n *

Re: [PHP-DEV] Closures and __FUNCTION__

2009-04-13 Thread Peter Danenberg
function Y($F) { $func = function ($f) { return $f($f); }; return $func(function ($f) use($F) { return $F(function ($x) use($f) { $ff = $f($f); return $ff($x); }); }); } That's interesting; I

[PHP-DEV] Closures and __FUNCTION__

2009-04-11 Thread Peter Danenberg
The original anonymous functions patch[1] contained support for __FUNCTION__ as a recursion mechanism in closures, such that I should be able to do something like this: $factorial = function($n) { if ($n == 1) return 1; else return $n * call_user_func(__FUNCTION__,

[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] Closures serialization

2009-01-04 Thread Johannes Schlüter
On Sat, 2009-01-03 at 14:12 +0100, Marcin Kurzyna wrote: as you said it's saving the zend_function member that is tricky. i thought i'd go with saving function string and recompiling it as you suggested (i don't want to mess with APC although i find the idea of opcode serialization much

Re: [PHP-DEV] Closures serialization

2009-01-03 Thread Marcin Kurzyna
Hi Marcus, You would need to provide a c level serialization that stores the $this pointer (the easy part) and the zend_function member (not easy). The second part requires storing of all static variables, which again is pretty easy but it also requires to store the function itself, which in

Re: [PHP-DEV] Closures serialization

2009-01-03 Thread Marcin Kurzyna
Hi Marcus, You would need to provide a c level serialization that stores the $this pointer (the easy part) and the zend_function member (not easy). The second part requires storing of all static variables, which again is pretty easy but it also requires to store the function itself, which in

[PHP-DEV] Closures serialization

2009-01-02 Thread Marcin Kurzyna
Hello internals and a happy new year. I've been meaning to ask this for some time now: why aren't closures serializable? The only on-list discussion about this that i've found is: http://marc.info/?l=php-internalsm=119837318407795w=2 Personally i'd find serialization of closures very useful

Re: [PHP-DEV] Closures serialization

2009-01-02 Thread Marcus Boerger
Hello Marcin, Friday, January 2, 2009, 8:56:41 PM, you wrote: Hello internals and a happy new year. I've been meaning to ask this for some time now: why aren't closures serializable? The only on-list discussion about this that i've found is:

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] closures questions

2008-07-24 Thread Lukas Kahwe Smith
On 24.07.2008, at 11:10, Christian Seiler wrote: Personally, I don't care whether a object-to-string cast is present or not. So lets remove it? I don't think Closure can be meaningfully exported. Can we prohibit it? Unfortunately, currently not, see the var_export code. I think we can

[PHP-DEV] closures questions

2008-07-22 Thread Lukas Kahwe Smith
Hi, I am sending this on behalf of Kalle: 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. 2) Closures can be defined as constants values because of its toString

Re: [PHP-DEV] closures questions

2008-07-22 Thread Lukas Kahwe Smith
On 22.07.2008, at 13:04, Lukas Kahwe Smith wrote: 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. would be nice to get this fixed, but at worst it should be

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] closures questions

2008-07-22 Thread Lars Strojny
Hi Christian, Am Dienstag, den 22.07.2008, 14:15 +0200 schrieb Christian Seiler: 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). Hm, I'm not sure who expected it that way. At least Stas and myself

Re: [PHP-DEV] closures questions

2008-07-22 Thread Stanislav Malyshev
Hi! so do we even want the toString() method? IMHO we should drop toString from Closure. Maybe it could return some relevant information for exporting the closure across data not a huge biggy to me. I don't think Closure can be meaningfully exported. Can we prohibit it? I guess this

Re: [PHP-DEV] closures questions

2008-07-22 Thread Lars Strojny
Hi Stas, Am Dienstag, den 22.07.2008, 13:09 -0700 schrieb Stanislav Malyshev: [...] I'm all for doing it, the problem is the syntax $foo-bar() is already used. But you can do $foo-bar-__invoke()! Can't we change zend_std_get_method() to return a zend_internal_function struct in case of a

Re: [PHP-DEV] closures questions

2008-07-22 Thread Marcus Boerger
Hello Lars, actually this is a very good idea and should work :-) marcus Tuesday, July 22, 2008, 10:15:03 PM, you wrote: Hi Stas, Am Dienstag, den 22.07.2008, 13:09 -0700 schrieb Stanislav Malyshev: [...] I'm all for doing it, the problem is the syntax $foo-bar() is already used. But

Re: [PHP-DEV] closures questions

2008-07-22 Thread Marcus Boerger
Hello Stanislav, Tuesday, July 22, 2008, 10:08:11 PM, you wrote: Hi! so do we even want the toString() method? IMHO we should drop toString from Closure. Sam here. It makes no sense anyway. This mail thread just proved that. Maybe it could return some relevant information for exporting

Re: [PHP-DEV] closures questions

2008-07-22 Thread Stanislav Malyshev
Hi! Can't we change zend_std_get_method() to return a zend_internal_function struct in case of a closure on a property? The only thing that needs to That means that: 1. We can't have properties named same as functions anymore 2. We'd have to check properties every time method name was not

Re: [PHP-DEV] closures questions

2008-07-22 Thread Marcus Boerger
Hello Stanislav, Tuesday, July 22, 2008, 11:07:58 PM, you wrote: Hi! Can't we change zend_std_get_method() to return a zend_internal_function struct in case of a closure on a property? The only thing that needs to That means that: 1. We can't have properties named same as functions

Re: [PHP-DEV] closures questions

2008-07-22 Thread Stanislav Malyshev
Hi! Nope. It means if you have a function named foo and a property foo that sores a closure and then call foo(), then obviously the function is called rather than the closure. That means you can't call the closure, and nothing alerts you of the problem. 2. We'd have to check properties

Re: [PHP-DEV] closures questions

2008-07-22 Thread Marcus Boerger
Hello Stanislav, Wednesday, July 23, 2008, 12:54:48 AM, you wrote: Hi! Nope. It means if you have a function named foo and a property foo that sores a closure and then call foo(), then obviously the function is called rather than the closure. That means you can't call the closure, and

Re: [PHP-DEV] closures questions

2008-07-22 Thread Stanislav Malyshev
Hi! H, the amount of problems is pretty long. So even though it might sound cool to do it. It is the better deceision to not allow it. Also you've shown several paths where it would slow general execution down. Yet I hate not being able to easily make it work. Well, $foo-bar-__invoke() is

[PHP-DEV] Closures - Windows build failure

2008-07-09 Thread Matt Wilmas
Hi all, Noticed that PHP 6 snapshots aren't working and got these errors when trying to build: zend_API.obj : error LNK2019: unresolved external symbol _zend_get_closure referenced in function _zend_is_callable_ex zend_execute.obj : error LNK2001: unresolved external symbol _zend_get_closure

Re: [PHP-DEV] Closures - Windows build failure

2008-07-09 Thread Scott MacVicar
Sorted now, the new file was missing from the build files. Scott Matt Wilmas wrote: Hi all, Noticed that PHP 6 snapshots aren't working and got these errors when trying to build: zend_API.obj : error LNK2019: unresolved external symbol _zend_get_closure referenced in function

Re: [PHP-DEV] Closures - Windows build failure

2008-07-09 Thread Matt Wilmas
Hi Scott, Ah thanks, so simple! :-O I should've investigated first since I figured it was probably a Windows-specific file, and not a missing #include, etc. - Original Message - From: Scott MacVicar Sent: Wednesday, July 09, 2008 Sorted now, the new file was missing from the build