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 that can be done with A or A+ my vote goes for either one. I don't
think rebinding will be very useful or intuitive though (unless one
would want to use it as a drop-in method for their classes).


On 12/16/09, Ionut G. Stan <ionut.g.s...@gmail.com> wrote:
> 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 is
>>> more time for this to mature if needed inside svn.
>>
>> 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)
>>
>> (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!
>>
>> (C): Javascript-like behaviour: Bind $this only when calling
>>       the closure as object method, else $this is undefined.
>>
>> (D): JS-like behaviour on top of (A).
>>           Please look at the RFC as to why I consider it to be a
>>           *REALLY*, *REALLY* bad idea.
>>
>> (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)
>>
>> My vote: (A+)
>>
>> Regards,
>> Christian
>>
>> PS: Note that I removed (B) from the possible options since I believe it
>> to be an EXTREMELY bad idea if one thinks it through. It was only added
>> to the RFC in order to give an overview over what was discussed
>> previously. Unless someone can make an extremely compelling case why I'm
>> wrong in this respect, I will refuse to implement (B).
>>
>
> --
> Ionut G. Stan
> I'm under construction  |  http://blog.igstan.ro/
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
--
Tjerk

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to