I like the proposal. I got near the same idea few hours ago :)
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 () { ... }); But it's not a big deal. I can accept both. Thanks. Dmitry. Christian Seiler wrote:
Hi everybody, We had that chat that Lukas announced yesterday and I promised Lukas to sum up the results of that chat. Problem was: There were only four people really there: Stas, Lukas, David and me. Lukas was interested in getting results in order to be able to release PHP 5.3 beta 1, Stas and I basically agreed on everything and unfortunately David didn't stay long enough in order to actually have a real discussion. I'm not assigning blame here for not coming to anyone, I just wanted to make clear that we actually couldn't reach a consensus - or well, rather, Stas and I could but I don't think that's the way it should be. However, Lukas wants to release 5.3 beta 1 and I can really understand him that he doesn't want to drag this out infinitely. I've written up the results of the discussion I had with Stas in the Wiki for everyone to read. I hope there's enough structure in it to make the main points clear. Please read it thoroughly before replying on-list in order to actually have a constructive dialogue. Here it is: <http://wiki.php.net/rfc/closures/object-extension> In order to be able to get beta 1 out as soon as possible, I propose the following: 1. Remove $obj->closure_method() call syntax for beta1. Make sure rebinding of $this is not in beta1. Freeze tomorrow (Friday, Jan 23rd). 2. Discuss my proposal and work out the details for adding manual rebining of $this in closures. Add that post-beta1 or if we don't get there in time at least post-5.3.0. Alternatively, if you really don't like it at *all* the current way and can't imagine ever finding a consensus on my new proposal with bind()/bindTo(), then I propose the following: 1. Remove $obj->closure_method() call syntax for beta1. Make sure rebinding of $this is not in beta1. Freeze tomorrow (Friday, Jan 23rd). This is exactly the state of alpha1 up to alpha3 so we won't actually be entering new territory with that. 2. *Remove* OOP support from closures post-beta1 (i.e. for beta2) in order to leave all options open. Thus, closures will always be normal functions without access to $this or having a class scope and that may later be added in the fashion that we agree upon once we do that. (It will certainly still be possible to define closures inside class methods then, they just won't know about that.) We definitely won't have to go so far as Johannes and remove closures entirely. Worst-case scenario, we remove OOP interaction and consider the proper way for that later. On the other hand, I really would dislike stripping closures of OOP support completely - at least not after it was in there for about six months (!) and nobody *really* complained about that until now, immediately before beta1... So, IMMEDIATE question: Is it ok for you to leave closure OOP support in beta1 on the level of alpha3 in order to allow Lukas and Johannes to finally release it? Even if you don't agree with my compromise proposal, please consider that in the worst case we can still remove all OOP support from closures after beta1. Regards, Christian
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php