RE: [PHP-DEV] Closures and $this: Please vote!
| From: | Mike Robinson | Date: | Wed, 16 Dec 2009 01:28:42 +0000 |
| Subject: | RE: [PHP-DEV] Closures and $this: Please vote! | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46439@lists.php.net to get a copy of this message | ||
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
FWIW, another non-internal-dev vote for (A+).
Best Regards
Mike Robinson