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

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

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

Re: [PHP-DEV] closures and $this

2010-07-22 Thread Adam Harvey
On 23 July 2010 03:05, Harald Lapp 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 ask, for which php r

[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

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

[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] Closures and $this: again!

2010-04-08 Thread Stanislav Malyshev
Hi! I see that still nothing happens with closures and $this, and it sounds like the overall feeling was that we still want $this in closures work, and most are inclined to A here: http://marc.info/?l=php-internals&m=126090656804423&w=2 or some version of it. So, can anybody provide any reaso

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 t

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/ (408)25

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 bin

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

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

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

Re: [PHP-DEV] Closures and $this

2009-12-16 Thread Richard Quadling
2009/12/15 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 perh

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 >

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

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

2009-12-15 Thread Richard Quadling
2009/12/15 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 shor

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 wor

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 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: http://www.php.

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 wa

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 Hannes Magnusson
On Tue, Dec 15, 2009 at 20:46, Christian Seiler 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 objects! +1 Pre

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

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

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 exac

Re: [PHP-DEV] Closures and $this

2009-11-20 Thread Michael Stillwell
On Thu, Nov 19, 2009 at 4:29 PM, Jelrik van Hal 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 difficult to > keep track

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 a

Re: [PHP-DEV] Closures and $this

2009-11-19 Thread Victor Bolshov
Hello. Jelrik, I could easily show a real-world example where using $this in closures could help. Consider Person class which has to verify that email address is unique. Suppose we have validation code in a single place and filter_var_array() is used to check all the data: class Person { .. f

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

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-18 Thread Chris Stockton
Hello, On Wed, Nov 18, 2009 at 11:44 AM, Stanislav Malyshev 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 into the >

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 feature

Re: [PHP-DEV] Closures and $this

2009-11-18 Thread Richard Quadling
2009/11/16 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. > >

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

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

Re: [PHP-DEV] Closures and $this

2009-11-17 Thread Chris Stockton
Hello, On Tue, Nov 17, 2009 at 2:59 AM, Mathieu Suen 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 5.3 I'd like t

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

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