Re: RFC: Anonymous Classes

From: Date: Fri, 27 Sep 2013 08:36:31 +0000
Subject: Re: RFC: Anonymous Classes
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-69382@lists.php.net to get a copy of this message
2013/9/27 Michael Wallner <mike@php.net> > On 27 September 2013 09:55, Nicolas Grekas <nicolas.grekas+php@gmail.com> > wrote: > > If you need access to the methods in AProxifier then why does the > anonymous > >> class extend A, you should extend AProxifier as you would with any other > >> class. > >> > > > > Because A has the behavior I want to extend? > > > > An other example: > > > > class A {...} > > class B {...} > > > > class Factory > > { > > protected function protectedMethod() {...} > > > > function getA() > > { > > return new class extends A {.. call Factory::protectedMethod()? > ..}; > > } > > > > function getB() > > { > > return new class extends B {.. call Factory::protectedMethod()? > ..}; > > } > > } > > > > This is possible and welcomed with closures. > > I see it as useful for anonymous classes than it is for anonymous > functions. > > What do others you think about it? > > -1 > > Just because a closure is an anonymous function does not mean that an > anonymous class has closure capabilites. > Just ... Isn't that something, we can simply keep out of _this_ RFC and create separate RFC(s) for it later? Like it was done with "$this in Closures"? > > -- > Regards, > Mike > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- github.com/KingCrunch

« previous php.internals (#69382) next »