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 modification"s 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  
> methods", as in:
> 
> $this->prop = function () { ...}
> $this->prop();
> 
> A few issues that may merit discussion (copied from the wiki page):

A few more things coming to mind without much thought:

      * What if both a method and a property with the name exist?
      * 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?
              * In the array($object, 'method') case: What's the scope
                for $this?
                
I don#t have an opinion on this feature, yet, I like the current
class-based object model as reading code is relatively simple, with this
addition (and the fact that you can create properties on the fly) we
create a powerful tool for really hard to read code.

johannes



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

Reply via email to